{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CS61A_fa99_mt1

# CS61A_fa99_mt1 - CS61A Midterm#1 Fall/1999 CS61A Fall/1999...

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

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) 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) CS61A, Midterm #1, Fall/1999 CS61A, Fall/1999 Midterm #1 Professor Brian Harvey 1

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

View Full Document
Problem #3 (2 points) Given the primitive procedure random
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}