MCS-177, Intro. to Computer Science I, Fall 2003
Homework Assignments
Chapter 9
- (15 points)Do exercise 9.2 on page 248
- (15 points) Do exercise 9.4 on pages 249 - 250. Make sure you
include a branch for sequence-ref.
- (10 points) Rewrite sequence-with-from-by so that it has a
branch for sequence-ref.
- (10 points) Do exercises 9.6 on page 252
Chapter 8
- Do exercise 8.4 on page 220
- Do exercise 8.5 on page 220
- Do exercise 8.6 on page 220
- Do exercise 8.7 on page 220 and 8.14 on page 225
- Do exercises 8.17 on page 229
Chapter 7
- Do exercise 7.4 on page 172
- Do exercise 7.13 on page 179
- Do exercise 7.14 on page 179
- Do exercise 7.21 on page 187
- Do exercise 7.44 on pages 205-206
Chapter 6
- Do exercise 6.22 on pages 161-162 ( 20 points)
- Do exercise 6.24 on pages 162-163 (10 points)
- Do exercise 6.26 on pages 163-164 (20 points)
Chapter 5
- Do exercise 5.5 on pagew 123-124
- Do exercise 5.6 on page 113
- Do exercise 5.15 on page 126
- Do exercise 5.20 on page 123
- Do exercise 5.23 on pages 126-127
Chapter 4
-
Do exercise 4.2, part a.2, on page 92.
-
Do exercise 4.4 on page 94.
-
Do exercise 4.11 on pages 99-100.
-
Do exercise 4.14 on pages 101-102.
-
Do exercise 4.15 on pages 103-104.
Chapter 3
-
Using the digit procedures from
September
12, write an iterative
procedure that counts the number of even digits in a number. Be sure
to include the invariant.
-
Do exercise 3.4 on page 57.
-
Do exercise 3.14 on page 70.
-
Do exercise 3.15 on page 70.
-
Do exercise 3.19 on page 72.
Chapter 2
-
Do exercise 2.8 on page 38.
-
Do exercise 2.11 on page 39.
-
Do exercise 2.17 on page 44.
-
Do exercise 2.18 on page 44.
-
Do exercise 2.20 on pages 44-45.
Chapter 1
-
Do exercise 1.6 on page 13.
-
Do exercise 1.12 on page 18.
-
Modify the procedure in exercise 1.12 so that it will return 17 if either
of its two arguments is even. If both are odd, this modified procedure
should still return their product.
-
Write a Scheme procedure that will find the smallest of three integers.
What are some good test values for this procedure?
-
The first-graders I used to work with liked to find the ``middle'' number
of two numbers. For example, the middle number of 3 and 9 is 6,
while the middle number of 1 and 10 is 5.5.
-
Write the Scheme
expression to find the middle number of 17 and 5,678,200.
-
Write a Scheme expression,
called middle, that finds the middle number of any two numbers.
-
What does the following
procedure do? Try to describe this as succinctly as you
can.
(define mystery
(lambda (x y z w)
(middle (middle x y)
(middle z w))))
MCS 177 homepage