CSpartA-Aug09Sol - Computer Science Foundation Exam August...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science Foundation Exam August 14, 2009 Computer Science Section 1A Name: PID: Max Pts Type Passing Threshold Student Score Q1 11 DSN 8 Q2 10 ANL 7 Q3 10 ALG 7 Q4 10 ALG 7 Q5 9 ALG 6 Total 50 35 You must do all 5 problems in this section of the exam. Partial credit cannot be given unless all work is shown and is readable. Be complete, yet concise, and above all be neat . Do your rough work on the last page.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1 ) (11 points) Recursion Write a recursive function that prints the contents of a linked list in reverse order. Make use of the list node struct and function header below. struct listnode { int data; struct listnode* next; }; void print_reverse(struct listnode* head) { Solution: if(head == NULL) return; print_reverse(head->next); printf("%d ", head->data); Grading Criteria: There are many ways to approach this problem. Be reasonable when grading. Base case – 3 points Printing the node in the proper place in the function – 4 points Making a proper recursive call – 4 points
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 09/21/2011.

Page1 / 6

CSpartA-Aug09Sol - Computer Science Foundation Exam August...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online