Computer Science 61A - Fall 1999 - Harvey - Midterm 1

# Computer Science 61A - Fall 1999 - Harvey - Midterm 1 -...

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

CS61A, Midterm #1, Fall/1999 CS61A, Fall/1999 Midterm #1 Professor Brian Harvey Problem #1 (3 points) What will Scheme print in response to the following expressions? If an expression produces an error message, 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. Also, draw a box and pointer diagram of the value produced by each expression. (let ((x '(a b c))) (cons (cdr x) (car x))) (cdar '((1 2 3) (4 5 6))) (append (cons '(a) '(b)) (list 'c 'd)) Problem #2 (2 points) file:///C|/Documents%20and%20Settings/Jason%20Raft. ..-%20Fall%201999%20-%20Harvey%20-%20Midterm%201.htm (1 of 5)1/27/2007 6:28:47 PM

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

View Full Document
CS61A, Midterm #1, Fall/1999 Suppose that you have a procedure (f n) that requires time theta( n ) and a procedure (g n) that requires theta( n^2 ). What is the order of growth required for a program to compute (* (f n) (g n))? There may be more than one correct answer; check all that are correct. ________ A. theta(n) ________ B. theta(n^2) ________ C. theta(n + n^2) ________ D. theta(n^3) Problem #3 (2 points) Given the primitive procedure random discussed in lecture, and the procedure
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

Computer Science 61A - Fall 1999 - Harvey - Midterm 1 -...

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

View Full Document
Ask a homework question - tutors are online