Answers for sample questions. 1. (b) commit 2.(f) b+c 3.(e) gcc -g prog.c // question doesn't specify the program needs to have a particular name 4.(b) preprocess, compile, link 5.(a) 1,3,4 // can't declare vars of type void, string to char =, illegal comments 6.(a) var=int, foo=int, baz=pointer to an int 7.(d) not legal C // no return type given for function 8.(e) Not legal C. 9.(d) x=4,y=1,z=5 10.(b) 4,2,4 11.(a) 0,4,0 // Its a bitwise and so the result is zero and the x++ won't execute // short circuit eval means the second ++x won't run but the y*=2 will 12.(d) none of the above // its actually 2,2,1 13.(d) Not legal C // you can't declare vars inside for loop headers 14.(c) 4,6 // previously there was an error in this answer so let's look at each one // individually: // 1 does not have any exec // 2 is a directory // 3 jim!=bob and haxors does not have exec // 4 yes - bob has exec // 5 bob is owner but the owner does not have exec // 6 jim!=bob others!=people and others!=haxors but world has exec so yes // // This leaves us with possible answers or 4 and 6 // so the correct answer is (c) 15.(d) 3 // 1 for each of the blocks and 1 for the indirect block 16.(b) A hard link can prevent a file being removed. // a file isn't deleted until its link count hits 0 // (e) is false because symlink don't need to point at anything valid 17.(b) Storage // (e) fails for processes and signals 18.(e) Movie // A movie will be a large file read sequentially 19.(i) none of the above // PATH, USER and HOME must be upper case.