The exam covers Chapter 1 in SICP and material in the lectures. The
exam is closed book.
In outline, the exam is as below. No further information on the exam
will be given.
============================================================
Spring 2002
91.301, Section 201
Name: _____________________
Quiz 1
1. Consider the following inductive definition of unary function f defined
on the natural numbers:
(i) f(0) =
(ii) f(succ(n)) =
For example, f(1) = .
(1) (5 points) Write a Scheme
procedure fr(n) that computes f(n) using a recursive process.
(2) (15 points) Write a
Scheme procedure fi(n) that computes f(n) using an iterative process.
(3) (15 points) Give a closed
form cff(n) for f(n).
(4) (20 points) Prove that
your closed form is correct --- that is, for every n³
0, cff(n) = f(n).
(5) (5 points) Write a Scheme
procedure fc(n) that computes f(n) in constant time and space.
(6) (20 points) Write a Scheme
procedure that
(7) (20 points) Write a
Scheme procedure (function) that