CS61A_sp04_mt1

CS61A_sp04_mt1 - CS 61A, Spring 2004, Midterm #1 This is an...

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

View Full Document Right Arrow Icon
1 CS 61A, Spring 2004, Midterm #1 This is an open book exam. When writing procedures, don’t put in error checks. Assume that you will be given arguments of the correct type. Question 1 (7 points): What will Scheme print in response to the following expressions? If an expression produces an error message, you may just write “error”; you don’t have to provide the exact text of the message. If the value of an expression is a procedure, just write “procedure”; you don’t have to show the form in which Scheme prints procedures. (se ‘a ‘(a)) (word ‘a ‘(a)) ((lambda (x) (bf (bl x))) ‘(abcd efgh)) (every (lambda (x) (bf (bl x))) ‘(abcd efgh)) (lambda (abcd) (bf (bl abcd))) (se (first ‘goodbye) (first ‘(hello))) (cond (3 4) (5 6) (else 7))
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Question 2 (7 points): Define a procedure make-closest-value that takes a nonempty sentence of numbers as its argument. It should return a procedure that takes a single number N as argument, and returns the number from the original sentence that’s closest in value to N. (If two numbers from the sentence are equally close to N, you can choose either of them.)
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.

Page1 / 6

CS61A_sp04_mt1 - CS 61A, Spring 2004, Midterm #1 This is an...

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