This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: University of Waterloo CS 136 Midterm Exam Winter 2008 CS 136: Elementary Algorithm Design and Data Abstraction Instructor: Prabhakar Ragde March 3, 2008 Start time: 7:00 PM. End Time: 9:00 PM. Duration: 120 minutes Number of exam pages (including this cover sheet): 13 Closed book (UWsupplied calculators okay) Name: Student Number: Signature: # Points Possible Score Comments 1 10 2 10 3 15 4 10 5 10 6 10 7 10 8 8 Total 83 Mark 100 Directions Write your name and student ID number on every page. If you need extra paper for a question, use the back of that question’s page. 1 Name: Student Number: Name: Student Number: Name: Student Number: 1. (10 Points) Write Scheme code to bind uwcs and vendetta to values as represented by the following boxandpointer diagrams. (a) [5 points] 135 133 125 136 134 uwcs (b) [5 points] vendetta 2. (10 Points) Draw the boxandpointer diagrams that represent the results of evaluating the follow ing Scheme code. (a) [5 points] ( define a ( cons empty empty )) ( define b ( cons a a )) ( define c ( list b a )) (b) [5 points] ( define x ( cons 1 ( cons 2 empty ))) ( define y ( cons 3 ( cons 4 empty ))) ( setfirst! x ( rest y )) ( setrest! y x ) CS 136 2 CS 136 2 CS 136 2 Name: Student Number: Name: Student Number: Name: Student Number:...
View
Full
Document
This note was uploaded on 10/02/2011 for the course CS 136 taught by Professor Becker during the Spring '08 term at Waterloo.
 Spring '08
 BECKER

Click to edit the document details