{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CSpartA-Aug09Sol

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

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

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.

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

View Full Document
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
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

CSpartA-Aug09Sol - Computer Science Foundation Exam...

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

View Full Document
Ask a homework question - tutors are online