Midterm 1 Rubric: == Problem 1 == Part A: 1. 2 pts 2. 1 pt 3. 2 pts 4. 1 pt All or nothing Part B: 2 points each, 1 point for Scheme printout, 1 point for box&pointer. All or nothing. == Problem 2 == Part A: 1. NOT circled 2. this question was discarded due to ambiguous wording. Everyone got point for this. 3. YES circled 4. NOT circled 1 pt each Part B: 2 pts each, all or nothing == Problem 3 == 1 point for each base case. 3 points for (knapsack (cdr ls) max-wt) call in the third blank. 4 points for the (+ (cdar ls) ...) call. -2 points if no (- max-wt (caar ls)), -2 points if no (+ (cdar ls) 3 points for the second (knapsack (cdr ls) max-wt) call == Problem 4 == Part A: 7 pts - perfect 6 pts - trivial mistake 4-5 pts - has the idea 2-3 pts - has an idea 1 pt - has an attempt Omitting collapse call is -3 pts. Using accumulate for collapse and map for every is -1 point total A perfect recursive solution gets 2 pts. Part B: 7 pts - perfect 6 pts - trivial mistake 4-5 pts - has the idea 2-3 pts - has an idea 1 pt - has an attempt +2 pts if used function composition +2 pts if used accumulate A perfect recursive solution gets 2 pts No points taken off for using collapse instead == Problem 5 == If the solution used mutual recursion, as in one procedure that handles tree, one procedure that handles forest and they call each other. 4 points minimum Of remaining 14 points, 6 points are for (trim tree) 8 points are for (trim-forest forest) -8 points if solution returned the original tree unchanged. -4 points if solution did not remove leaf but rather replaced them with nil -2 points if used append/list to construct the list in trim-forest instead of cons 4 points maximum if called trim on a forest -2 points if missing base cases or having incorrect base cases. Most incorrect non-mutual recursion solutions were graded on a case-by-case basis. == Problem 6 == Part A. make-char: 2 points get-potions, get-name, get-health: 1 points each All or nothing. Part B: 1 point each for the 4 necessary changes. 1 point for NOT changing cdr in (cdr (get-potions char)) 1 point for NOT changing null? 1 point for NOT changing anything else == Problem 7 == 18 - perfect 16 - trivial mistakes 14-12 - has the idea 6-10 - has an idea 2-4 - has an attempt -8 points for writing a procedure that checks only the first level and does not go deep. -2 points for each missing base cases -4 points if after you checked whether the list contains all atoms, you call pure? on (car ls) without making sure that the list contains all lists -1 point for data abstraction mistakes, like using first and butfirst -14 points for writing a procedure that checks only whether the list contains all atoms