CS140 Midterm 2 Grading Guide
Written Exam
- (14 points)
- (2 points) 1 point for d (map), 0 for anything else
- (2 points) 1 point for e (set), 0 for anything else
- (2 points) 0 points for anything else
- (2 points) 0 points for anything else
else
- (2 points) 1 point for b (list), 0 for anything else
- (2 points) 0 points for anything else
- (2 points) 1 point for b (list), 0 for anything else
- (8 points) 2 points each for a, b, x, and y
- (6 points) 6 points for memory leak, 3 points if their answer correctly
identifies that the problem is that the first allocated piece
of memory is no longer accessable after the code executes, yet
has not been deleted.
- (10 points)
- part a ( 5 points): 1 point each for x, newnode, y,
Jackie->next, and Frank->next
- part b ( 5 points): 1 point each for x, newnode, y,
Jackie->next, and Sue->next. Deduct 1 point if Frank->next is
not null. Grade this part based on how the student answered part a.
For example, if the student's answer for part a has Frank pointing
to Jackie and Jackie->next being the null pointer, then give the
student full marks for part b if their answer for part b is
consistent with their answer to part a.
- (10 points) There are two possible correct answers:
- friend1 does not exist: In this case 4 points for saying that
friend1 does not exist, 3 points for correctly stating that friends_it
will point to a sentinel node, and 3 points for correctly stating
that the code will seg fault when you try to insert into the set.
- friendsSet is a copy: 7 points for saying that it makes a copy of the set, and 3 points
for identifying why that is a problem, namely that the original set
does not get properly updated.
- (10 points) 5 points for each part. Pretty much all or nothing
unless you see something for which you wish to award partial credit.
- The
only acceptable reason for the code fragment being wrong in part a is
that the pointer is uninitialized and hence they are attempting to
reference the name and age fields through an invalid pointer. They do
not have to mention that the code may seg fault in order to get full
credit. If they say that the code will seg fault but do not explain why,
then that is 0 credit. The answer needs to be explicit about why the
code fragment is incorrect.
- The only acceptable answer is adding a "p = new Person();"
statement. It's okay to modify the declaration to read
Person *p = new Person(); and it's also fine to leave
the () off of person (hence p = new Person;).
- (12 points) 4 points each. For parts a and b deduct 1 point for
having extraneous constants or terms (e.g., O(.10*2n) or
O(2n + n)).
For part c the reason must reference the Big-O
notations computed in parts a and b. Deduct 1 point for not referring to
the Big-O running times (they don't have to explicitly say Big-O, but they
must indicate what the Big-O running times were). If they mis-compute the
Big-O running times for Algorithms 1 and 2 and their miscomputation has
Algorithm 2 being faster than Algorithm 1, then give them full credit
in part c if they say Algorithm 2 is faster than Algorithm 1.
- (10 points)
- (3 points) All or nothing
- (7 points)
- 4 points for stating the Big-O running times
of the two functions (2 points each).
- 3 points for correctly stating that the algorithm with the
smaller Big-O running time is the better algorithm, even if the
Big-O running times they compute are wrong.
- (10 points)
- (4 points): The order of items in the list is correct. You
may award partial credit for incorrect items--use your judgment.
- (2 points): The list has sentinel nodes at each end.
One point if only one sentinel node is drawn in the diagram.
- (2 points): nit points to the second list element (even
if the student incorrectly ordered the items in the list nit
should still point to the second list element)
- (1 point): nit1 points to the sentinel node at the
end of the list
- (1 point): rnit points to the last list element
Coding Exam
Deductions for otherwise correct programs:
- There is an overall deduction of 1 point for forgetting to pass any
non-modified object
by reference. This deduction is only applied once.
- There is a deduction of 1 point for using non-meaningful variable
names.
- There may be deductions for inefficient or convoluted code.
- There is a 15 point deduction for a failure to use a map to store
name/problem count pairs and there is a 15 point deduction for a failure to use a
set to store correctly solved problems.
- List
- (10 points: Correctly moving through the list and
using the iterator to access the user's weight
- (10 points: Correctly accumulating the sum of user
weights and the number of users
- (10 points: Correctly computing the average weight
- Contest
- (10 points) Correctly recording the first time a problem
is solved.
- (12 points) Correctly crediting the first user to solve
a problem.
- (8 points) Correctly finding the winning score and
printing in alphabetical order all users with that winning
score