COMPSCI 3S Midterm: cs3-sp2001-mt1-Garcia-exam
University of California, Berkeley – College of Engineering
Department of Electrical Engineering and Com puter Sciences
Spring 2001 Instructor: Dan Garcia 2001-02-26
CS 3 Midterm
#1
Personal Information
Last name
First Name
Student ID Number
Lab Section Time & Location you attend
All the work is my own. I had no prior knowledge of the
exam contents nor will I share the contents with others
in CS3 who have not taken it yet. (please sign)
Instructions
• Question 0 (worth 1 point) Please fill in the
front and write your name on every page!
• You have two hours to com plete this quiz.
The quiz is open book and open notes, no
com puters.
• Partial credit will be given for incom plete /
wrong answers, so please write down as
much of the solution as you can.
• You may always write auxiliary functions
for a problem unless they are specifically
prohibited in the question.
• Feel free to use any Scheme function that
was described in sections of the textbook
we have read without defining it yourself.
Do not use functions or constructs that we
have not covered, such as recursion.
• You do not need to write comm ents for
functions you write unless you think the
grader will not understand what you are
trying to do otherwise.
• Please comm ent on the exam on the right.
Rate its difficulty (0 = cake, 5 =
impossible), fairness (0 = unfair, 5 = fair),
and feel free to add any other com ments
that com e to m ind.
Name: __ __ __ ___ __ __ ___ __ __ ___ __ __ ___ __ __ ___ _
Page 2 of 2
Grading Results
Question
Max.
Points
Points
Given
0 1
1 20
2 10
3 8
4 8
5 13
Total 60
Comments:
• Difficulty (0=easy, 5=hard):
• Fairness (0=unfair, 5=fair):
• Other thoughts?
Name: _____________________________________
Page 3 of 3
Question 1 : You’re in Big Momma’s house now… (20 points)
Your grandmother tells you that back in her day they didn’t have those fancy
computers to evaluate all of their computer programs for them. No, they
evaluated all of their programs themselves. Prove to your grandm other that you
could do the same if you had to. For each of the following Scheme expressions,
write the value that would be returned if we were to evaluate it in the Scheme
interpreter. Write your answers next to each expression in the space provided. If
an expression results in an error, just write the word ERROR and describe the
error in a few words. If the value of an expression is a procedure, just say
PROCEDURE. Assum e that the following de f i ne s have already been m ade:
( d e f i ne ma nt r a ‘ ( c a l i s g r e a t ) )
( d e f i ne ( we i r d a b c ) ‘ ( / 1 00 a ) )
( d e f i ne ( mu l t - 10 n) ( wo r d n 0) )
CAUTION: These are quite subtle; make sure you go through them carefully.
( * ( + 2 ( / 7 1 )
( * ) ) )
( e qua l ? ( qu ot e ( 1 ) ) ( s e ( 1) ) )
( i f ( = 1 ‘ 1 ) + - )
( i f < 3 4)
( a nd ( i f # f # f #t )
‘a
‘(b)
( n ot ( = 1 2) )
ma nt r a )
( b l ( b f ma nt r a ) )
( l a mbd a ( ) m a n ‘ t ‘ r ‘ a )
( we i r d 0 1 2)
( e ve r y mul t - 10 ‘ ( we i r d 10 2 3) ) )
( a c c u mul a t e - ( e ve r y mul t 10 ‘ ( 3 2 1) ) )
Document Summary
University of california, berkeley college of engineering. Departm ent of electrical engineering and com puter sciences. Personal information: please com m ent on the exam on the right. Rate its difficulty (0 = cake, 5 = im possible), fairness (0 = unfair, 5 = fair), and feel free to add any other com m ents that com e to m ind. I had no prior knowledge of the exam contents nor will i share the contents with others in cs3 who have not taken it yet. (please sign) Instructions: question 0 (worth 1 point) please fill in the front and write your nam e on every page, you have two hours to com plete this quiz. Question 1 : you"re in big momma"s house now (20 points) Your grandm other tells you that back in her day they didn"t have those fancy com puters to evaluate all of their com puter program s for them .