====================================================================== Faculty of Applied Science and Engineering, University of Toronto CSC181: Introduction to Computer Programming, Fall 2000 First Term Test Marking Scheme ====================================================================== ---------- Question 1 ---------- Scheme: * (-1/-2): Student number not written on every page. Comments: * These are essentially free marks. So take them! A surprising number of students did not get full marks on this question. ---------- Question 2 ---------- Scheme (for each question): * (-1): Inadequate/missing definition * (-1): Inadequate/missing explanation of significance * (-1): Inadequate/missing example Comments: * Many students did not provide an example. * At least 10 students said that table lookup involved state machines. I have absolutely no idea why one would think the two were related, let alone why this answer appeared in at least 10 term tests. If you have any insights into this, please let me know. ---------- Question 3 ---------- Scheme (for each question): * (-2): Incorrect answer Comments: * Generally well done. ---------- Question 4 ---------- Scheme (for each question): * (-1): Incorrect legal/illegal answer * (-1): Incorrect supplementary answer Comments: * Generally not well done. * For the assignment '*q = *p;' and '**s = b;', 'legal' was accepted, because technically you could perform these assignments at runtime, even though q and *s are dangling. These answers do not deserve full marks, though. ---------- Question 5 ---------- Scheme: A (-1): Uses temporary array B (-1): Array parameter not modified C (-1): Off-by-one error D (-1): Undeclared variable E (-2): Array parameter reversed twice F (-1): Syntax error G (-1): Use % instead of / I (-1): Function returns something J (-1): Bad pointer dereference K (-1): Bad swap L (-1): Uninitialized variable X (specified): Other error Comments: * Generally well done. ---------- Question 6 ---------- Part a) Scheme: All or nothing. Part b) Scheme: * (-1/-2): Inadequate/missing explanation. Part c) Scheme: A (-1): Off-by-one error B (-2): Inefficient C (-1): Bad return value D (-1): 'get' function not used E (-1): Calculation error F (-1): Bad use of 'break' Comments: * Generally well done. * Using a 0..n-1 scheme or using a 1..n scheme for indexing the matrix were equally acceptable. Using a 0..n scheme wasn't acceptable. * A few students got the logic of the if-statement wrong, writing something like: if (get (A, i, j) != get(A, j, i)) return 0; else return 1; Of course, this will return 1 prematurely. ---------- Question 7 ---------- Part a) Scheme: * (-1/-2/-3): Incorrect answer. Comments: * Generally well done. * A few students did not realize that the loop counter only went from 1 through n-1, and therefore incorrectly answered (n(n+1))/2. Part b) Scheme: A (-1): a[0] is not 20 B (-2): a[1] is not 5 C (-1): a[2] is not 32 D (-1): a[3..4] and a[6..8] are not 0 E (-1): a[5] is not 15 F (-1): a[9] is not 11 Comments: * Only a handful of students did this question well. * Quite a few students did not realize that the array elements were initialized to zero. ---------- Question 8 ---------- Scheme: A (1/2): Struct and typedef B (.5/1): 'init' prototype C (.5/1): 'add' prototype D (.5/1): 'contains' prototype E (1): 'init' basic initialization F (1): 'init' returns pointer to properly malloc'd set G (1): 'init' initializes set's elements pointer to malloc'd array H (1): 'add' checks for duplicates I (1/2): 'add' correctly implements growing of set J (1/2): 'add' basic implementation K (1/2): 'contains' basic implementation X (-1): syntax/other error Comments: * It appeared some students were intimidated by the fact that this question was using pointers and memory allocation. It should be pointed out, however, that 11 out of the 15 marks were not related to pointers or memory allocation. * H was missed by quite a few students. ---------- Question 9 ---------- Part a) Scheme: Any tile was fine. Part b) Scheme: A (-1): Off-by-one error B (-1/-2): q range in 't' incorrect C (-1/-2): x range in 't' incorrect D (-1): Other range in 't' incorrect E (-1): Attempt to assign 't' as if it were a pointer F (-1): 'q' incorrect G (-1): 'x' incorrect H (-1): Temporary array used I (-1): Infinite loop J (-1): Uninitialized variable K (-1): 'q' and 'x' are interchanged L (-1): Letters not copied back to 't' from temp array(s) M (-1): Bad swap N (-1): Loop syntax incorrect X (specified): Other error Comments: * Performance on this question was across-the-board.