Computer Science 61A - Spring 1997 - Harvey - Midterm 2

# Computer Science 61A - Spring 1997 - Harvey - Midterm 2 -...

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 61A CS 61A, Spring 97 Midterm 2 Professor Harvey Problem #1 (6 points): What will Scheme print in response to the following expressions? If an expression produces an error message, you may just say &quot;error&quot;; you don't have to provide the exact text of the message. If the value of an expression is a procedure, just say &quot;procedure&quot;; 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. (list (cons 2 3) (list 4 5)) (cons (cons 2 (cons 3 4)) '()) (append '() '(a b)) (cdar '((1 . 2) (3 4))) Problem #2 (4 points): True or false? ____Tagging complex numbers with rectangular or polar as in section 2.42 could be avoided if the different representation contents were distinguishable. ____In both its verions in section 2.4.1, (make-from-real-imag x y) always produces rectangular form. ____A generic add as in section 2.5.1 checks the types of all of its arguments. ____A generic add as in section 2.5.1 takes exactly two arguments. Problem #3 (7 points): Complete the following definitions of some basic list-manipulation operations as accumulations, filters, or maps. Fill in the table below from the numbers of selections offered. If no appropriate selection exists, write &quot;none&quot; and write out the solution. We give an example for part A....
View Full Document

## Computer Science 61A - Spring 1997 - Harvey - Midterm 2 -...

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

View Full Document
Ask a homework question - tutors are online