CS61A_fa99_mt1

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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Problem #3 (2 points) Given the primitive procedure
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.

This note was uploaded on 11/23/2010 for the course CS 61A taught by Professor Harvey during the Fall '08 term at Berkeley.

Page1 / 4

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

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