1. 1. D 2. C 3. B 4. F 5. A 6. E 2. // Find the sum of the elements in an array. int foo (int *x, int y) { if (y == 0) return x[0]; else return x[0] + foo (x+1,y-1); } 3. 3 9 1 33 4. 1. exp_bias = 127 2. (1 << 31) 3. && -> & 4. C 5. C 6. C 7. (exp == 0) 8. C 9. C 10. C 11. C 12. C 13. (exp >= 255) 14. C 15. C 5. stack: 0xbffff6e0 v2 0xbffff6dc v1 0xbffff6d8 v0 0xbffff6d4 ra 0xbffff6d0 old %ebp 0xbffff6cc ls.c 0xbffff6c8 ls.xyz[2] 0xbffff6c4 ls.xyz[1] 0xbffff6c0 ls.xyz[0] 0xbffff6bc rgb 0xbffff6b8 &rgb 0xbffff6b4 ls.c 0xbffff6b0 ls.xyz[2] 0xbffff6ac ls.xyz[1] 0xbffff6a8 ls.xyz[0] 0xbffff6a4 3 0xbffff6a0 5 0xbffff69c v0 0xbffff698 v1 0xbffff694 v2 A: struct color * B: v2,v1,v0,5,3,ls,&rgb C: 0xbffff6d0 D: -4 6. from left to right top to bottom part 1: (a) 4 - 4 - 4 16 - 64 - 16 (b) 1 - 1 - 1 4 - 64 - 4 part 2: (a) 4 - 4 - 4 16 - 16 - 64 (b) 1 - 1 - 1 16 - 4 - 16 7: Signaling: 0 Producer/Consumer: Producer thread: swap P(mutex) and P(not_full) N, 0, 1 8. 1) a 2) b 3) e 4) c 5) e 6) c 9: Part One: Change pid = waitpid(-1,&status,WNOHANG); to while((pid = waitpid(-1,&status,WNOHANG) > 0); Part Two: There are several solutions. One possibility is to add the following line to function echo: pthread_detach(pthread_self()); One student pointed out that by having the parent call exit(0); after reading end-of-file, it might termiante threads before they have completed their tasks of printing out "ouch!".