Computer Science 61A - Spring 1995 - Clancy - Midterm 1

Computer Science 61A - Spring 1995 - Clancy - Midterm 1 -...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: CS61A: Midterm #1--Spring 1995 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? , including recursive calls, during the evaluation of the following expression: (keep-all-vowels '(eva ai xxx a))...
View Full 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 / 4

Computer Science 61A - Spring 1995 - Clancy - 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