CS140 -- Midterm Exam: Grading
Just one comment -- I do give partial credit for certain answers
below. If you did get partial credit, you should know that your
answer was wrong, but enough of your thinking was right to warrant
some points. If you did not get partial credit for an answer,
do not come and try to argue with me and explain your thinking --
my answer will be that you got the problem wrong and you were not
thinking along the lines that I wanted you to think along.
The multiple choice grading is kind of detailed -- it was done
automtically, obviously with a program that you are capable of
writing. If you'd like to see it (of course, it uses the
fields library), it is in
grader.c.
Try it out if you want.
Questions 1-3
Questions 1 through 3 were worth three points each.
Grading was as follows:
- Question 1: 3 points for c. Zero points for anything else.
- Question 2: 3 points for i. I gave one
point for g, d, and j, which meant that you
made one small, reasonable mistake.
- Question 3: 3 points for c, and one point for f,
which happened when you thought that a() modified
i and j. Also, if you missed question 1, but
gave the same answer for questions 1 and 3, then I gave you
1 point, because you at least understood that a() did
not modify i and j.
Questions 4-7
Questions 4 through 7 were worth four points each.
Grading was as follows:
- Question 4: 4 points for b. Zero points for anything else.
- Question 5: 4 points for d.
Zero points for anything else.
- Question 6: 4 points for d.
One point for b, which I took as meaning that you thought
that s and s1 pointed to different places
(i.e. "s = strdup(revstring(s1));").
- Question 7: 4 points for h, 3 points for j,
1 point for c, which is what you would get if there
were actually memory allocated for s.
Questions 8-11
Questions 8 through 11 were worth four points each.
Grading was as follows:
- Question 8: 4 points for g, and one point for
h, which means that you messed up the (i+1) in
line 2.
- Question 9: 4 points for l, three points for
m, meaning you had the value of i wrong, and
one point for h, meaning you missed the error, but
got the math right.
- Question 10: 4 points for k, three points for
l, meaning you had the value of i wrong, and
one point for h, meaning you missed the error, but
got the math right.
- Question 11: 4 points for e, three points for
d, meaning you spaced on the last line, and
one point for k, meaning you though line two was
an error since it had no words on it.
Questions 12-14
Question 12 was 4 points. Questions 13 and 14 were 5 points each.
Grading was as follows:
- Question 12: You received 4 points for answering
b. If you answered b and any other answer,
but you didn't circle c, you got 2 points. If you
answered b and c (and/or any others), you got
1 point. If you did not answer b, you received zero
points.
- Question 13: If you answered just c and e,
you received 5 points. If you answered c or >e only,
received 4 points.
If you answered c and/or e
and also put down other things, you started with the points
above, and were penalized in the following way:
- 1 point off for answering b and/or f, because
at least their types are all correct -- they are just
missing memory allocation.
- 2 points off for answering a, d and/or g.
If you didn't answer c or e, then you received one
point for ansewring b or f, but not the others.
Zero otherwise.
- Question 14: If you answered just c and g,
or c, g and d,
you received 5 points. If you answered
c only g only, c and d or
g and d, you received 4 points. If you answered
d only, then you received 3 points.
If you answered c d and/or g
and also put down other things, you started with the points
above, and were penalized in the following way:
- 1 point off for answering e, h and/or f, because
they aren't quite as bad as the others.
- 2 points off for answering a and/or b.
If you didn't answer c, d or g, then you received one
point for ansewring e, h or f, but not the others.
Zero otherwise.
Question 15
Question 15 was worth 10 points, allocated as follows:
- Getting the main(int argc, char **argv) declaration right:
2 points.
- Getting the for() loop right: 3 points. If you had the
indices wrong, you lost a point.
- Doing a printf("%c", ... or a putchar(): 1 point.
- Actually finding and printing the right character: 4 points.
Question 16
Question 16 was worth 25 points, allocated as follows:
- Declarations: 3 points
- Having a FILE *: 1/2 point.
- Having an int for n: 1/2 point.
- Having an array for the lines: 1 point. Only 1/2 point if you
got the type wrong.
- Having a IS, or a big character array for input: 1/2 point.
- Having an induction variable for the for/while loop: 1/2 point.
- Error checking for the right number of argument: 1 point.
- Getting that error checking right and printing out the right
thing: 1 point.
- Setting n with atoi() or ssanf(): 2 points.
- Error checking n: 1 point.
- Getting that error checking right and printing out the right
thing: 1 point.
- Doing the fopen(): 1 point.
- Error checking the output of fopen(): 1 point.
- malloc()-ing an array for the lines: 1 point.
- Making sure you have n elements in that malloc(): 1 point.
- Getting the types and sizeof() in the malloc()
right: 2 points.
- Initializing the IS (you get this point for free if
you used gets()): 1 point.
- Having a loop to read input: 1 point.
- Having the loop end on EOF or n lines: 2 point. If you only
had it end on one of these conditions, you lost a point.
- Calling strdup(): 2 points.
- Having a loop to write the output: 1 point.
- Having the right variables in that loop so that the lines get
printed backwards: 1 point.
- Getting the fprintf() or fputs right: 1 point.