CS211 Prelim 2, Spring 2006 Grading Guide Problem 1: -4 points for each problem Common mistakes: -Strings aren't mutable! -definition of non-terminal Problem 2: Part a: -2 If solution incorrect. -1 If did not specify observer. Part b: -2 For each incorrect argument. -2 If a pair of arguments is swapped. Part c: -2 If variables are shadowed, but not initialized in the Annulus. -2 If not specified what methods should be overridden. -2 Incorrect variable initialization / no appropriate definitions. -2 Inner radius not initialized in constructor. -6 No area method. -1 If rewrote code from super.area(). Common mistakes: 1) Shadowing fields of the super class and then not initializing them. 2) Making two calls to the super constructor and expecting it to return a value. Problem 3: Part a: 5 points 3 pts max if height is not true 4 points max if root is not 2 no points if not a BST Part b: all or nothing Part c: Base case: 3 points; 2 points max if h=1, not 0 Inductive hypothesis: 3 points; 0 points if not strong induction on height of tree Inductive case: 10 points -2 for not stating that all elements of the tree are present after the call to swap() -8 points for proof Problem 4: Part a: 6 points -1 if identify problem as void remove(int x) (correct answer is void remove(Object x)) if correct problem identified, -3 if no statement about the problem -2 if no specification (the comment) Part b: 6 points -4 if identify a legitimate problem about add (add is not an observer) if correct problem identified, -3 if no statement about the problem -2 if specification (the comment) Part c: 6 points -2 for "small problem" -4 for "big problem" -6 "completely wrong" Part d: -7 if answered "no" -(2 to 4) for problems in the code