Computer Science 61A - Spring 1998 - Fateman - Midterm 1

Computer Science 61A - Spring 1998 - Fateman - Midterm 1 -...

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

View Full Document Right Arrow Icon
CS 61A Midterm #1, Sp98 CS 61A Spring 1998 Midterm 1 Question #1 What will Scheme print in response to the following expressions? If it produces an error or runs forever without a result, just say "error". If it is a procedure, say "procedure". Assume no global variables have been defined beforehand except where noted. (word '(+2 3) (+2 3)) ((lambda (x y z) (* 5 y)) 3 4 7) ;from ex. 1.32, p. 61 (accumulate se '(hurrah) (lambda(x) (word 'hip x)) 1 (lambda (x) (1+x)) 3) ((if 3 - *) 32 2) (a b c) (let ((a 5) (* +) (+ *)) a (+ a a)) ((lambda (-) (- 2)) (lambda (*) (+ * 4) )) Question #2 (True or False?) _______ A Ø (log(2n)) algorithm is slower than a Ø (2 log(n)) algorithm _______ For small size inputs knowing the Ø order of an algorithm is more useful than for large inputs _______ If f(x) is Ø (log x), then lim (x => infinity) f(x)/(log x) is zero _______ If f is defined as (define (f x) (* x x x)) then and applicative-order evaluation of (f (g y)) evaluates (g y) more often than a normal -order evaluation _______ Function g below defines a linear recursive process
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/17/2009 for the course CS 61A taught by Professor Harvey during the Spring '08 term at Berkeley.

Page1 / 3

Computer Science 61A - Spring 1998 - Fateman - Midterm 1 -...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online