Computer Science 61A - Summer 2000 - Coates - Midterm 1

Computer Science 61A - Summer 2000 - Coates - Midterm 1 -...

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

View Full Document Right Arrow Icon
CS 162, Midterm #2, Fall 2000 CS 61A, Summer 2000 Midterm #1 (Sole midterm) Professor Allison Coates Problem #1 (5 points): Give the commands necessary to perform the following tasks. (a) Emacs 1. Load the file ~cs61a/lib/foo.scm into an Emacs buffer. 2. Start a Scheme buffer and load ~cs61a/lib/foo.scm into that buffer. (b) Unix 1. Change into your home directory. Confirm you are in your home directory 2. Create the directory sols . Copy all the files from ~cs61a/sol into sols . 3. Confirm the files are in the sols directory. Problem #2 (10 points): What will Scheme print in response to the following expressions? If an expression produces an error message or runs forever without producing a result, 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. Assume that no global variables have been defined before entering these expressions (other than the predefined Scheme primitives), except a and b (define a 'goodbye) (define b 'hello) (let ((a 'hi) (b a)) (list a b)) (let ((a 'hi) file:///C|/Documents%20and%20Settings/Jason%20Raft. ..20Summer%202000%20-%20Coates%20-%20Midterm%201.htm (1 of 7)1/27/2007 6:29:50 PM
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS 162, Midterm #2, Fall 2000 (list a (let ((b a)) b))) (((lambda (one) (lambda (two) (list one two 'three))) 'a) 'b) (let ((x 3)) (lambda () x)) Given each Scheme printout: (a) Draw a box and pointer diagram representing the structure. (b) Give an expression using only cons and list that would create the structure. (c) Provide a scheme expression to retrieve the number 3 from this structure. > foo ((1 . 2)((3) . 4) 5) > bar (1 (2 3) 4 ((5))) Problem #3 (10 points): For each of the following statements, indicate whether the statement is true or false by circling the appropriate response. Also, explain in one gramatically [sic] correct Enlish [sic] sentence why each statement is true or false. (a) A function that returns a pair containing one answer in the car and one answer in the
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.

Page1 / 7

Computer Science 61A - Summer 2000 - Coates - Midterm 1 -...

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