CS61A_sp95_mt1

CS61A_sp95_mt1 - CS61A Midterm#1-Spring 1995 CS61A Spring...

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

View Full Document Right Arrow Icon
CS61A, Spring 1995 Midterm #1 Question 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. (first (butfirst '(yesterday))) ((lambda (x) x) (lambda (x) x)) ((lambda (w) (sentence (word 'h w) (word 'th w))) 'ere) (+ (* 3 5 0 7) (- 8 2)) (and (> 2 3) (/ 5 0)) (let ((me 'you) (you 'me)) (sentence 'you 'love me)) Question 2 (3 points): Consider the following code. (define (all-vowels? wd) (cond ((empty? wd) #t) ((vowel? (first wd)) (all-vowels? (bf wd))) (else #f))) (define (keep-all-vowels sent) (cond ((empty? sent) '()) ((all-vowels? (first sent)) (se (first sent) (keep-all-vowels (bf sent)))) (else (keep-all-vowels (bf sent))))) List all of the calls to all-vowels?
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 11/23/2010 for the course CS 61A taught by Professor Harvey during the Fall '08 term at Berkeley.

Page1 / 3

CS61A_sp95_mt1 - CS61A Midterm#1-Spring 1995 CS61A Spring...

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