{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


CS61A_sp99_mt1 - CS61A Midterm#1 Spring 1999 CS61a Spring...

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

View Full Document Right Arrow Icon
CS61a, Spring 1999 Midterm #1 (Total: 20 points) Question #1 [3 points] What will Scheme print in response to the following expressions? If an expression produces an error message or runs forever without producing a result, you may just say "error"; you don't have to provide the exact text of the message. If the value of an expression is a procedure, just say "procedure"; you don't have to show the form in which Scheme prints procedures. Assume that no global variables have been defined before entering these expressions (other than the predefined Scheme primitives). (word 'for '(no one)) (if (first 'flying) 'yes 'no) (every (lambda (w) (last (butlast w))) '(think for yourself)) (let ((first last) (last first)) (first (last '(tomorrow never knows)))) CS61A, Midterm #1, Spring 1999 CS61a, Spring 1999 Midterm #1 1
Background image of page 1

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

View Full Document Right Arrow Icon
((lambda (a b c) (word b a c)) '(i want you)) ((lambda (a) (a 3)) (lambda (x) (word x x))) Question #2 [4 points] Write a procedure n-to-nth that takes a positive integer n as its argument, and returns the value of n ^ n ( n to the n th power), computed by multiplying n by itself n times .
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.

{[ snackBarMessage ]}