CS360 Final -- December 10, 2002

Answers to Question 1

The key here is to know which file descriptors match which files. Initially, when p1 is called, we have:

So, the answers:

If you want to try these out yourself, grab wcat.c and p1.c from this page.

Grading: 18 points

For the majority of commands, each command was worth 1 point, divided in half. You got half credit if you got the correct input file and half credit if you got the correct output file. If you got the correct input file but wrote two output files, you only got half credit.

If there was an error message, I gave lots of partial credit on which error message was produced. If the actual error was a read error, then you received .25 for putting down any read error, even if you didn't put down the correct one. If you put down a write error, then you received .15 points, and if you answered e, then you received .1 points. Finally, if you put down the wrong kind of error, but the correct file descriptor, you received .3 points.

Four questions had special grading.

In case you're wondering, this means that there were 13 commands worth one point, 2 commands worth .5 points, and 2 commands worth 2 points.

Oh, and the random lottery extra credit was answering i, w, g, a for C18.