MCS-177, Intro. to Computer Science I, Fall 2003 
Homework Assignments


Chapter 9
  1. (15 points)Do exercise 9.2 on page 248
  2. (15 points) Do exercise 9.4 on pages 249 - 250. Make sure you include a branch for sequence-ref.
  3. (10 points) Rewrite sequence-with-from-by so that it has a branch for sequence-ref.
  4. (10 points) Do exercises 9.6 on page 252
Chapter 8
  1. Do exercise 8.4 on page 220
  2. Do exercise 8.5 on page 220
  3. Do exercise 8.6 on page 220
  4. Do exercise 8.7 on page 220 and 8.14 on page 225
  5. Do exercises 8.17 on page 229
Chapter 7
  1. Do exercise 7.4 on page 172
  2. Do exercise 7.13 on page 179
  3. Do exercise 7.14 on page 179
  4. Do exercise 7.21 on page 187
  5. Do exercise 7.44 on pages 205-206

Chapter 6
  1. Do exercise 6.22 on pages 161-162 ( 20 points)
  2. Do exercise 6.24 on pages 162-163 (10 points)
  3. Do exercise 6.26 on pages 163-164 (20 points)


Chapter 5
  1. Do exercise 5.5 on pagew 123-124
  2. Do exercise 5.6 on page 113
  3. Do exercise 5.15 on page 126
  4. Do exercise 5.20 on page 123
  5. Do exercise 5.23 on pages 126-127

Chapter 4
  1. Do exercise 4.2, part a.2, on page 92.
  2. Do exercise 4.4 on page 94.
  3. Do exercise 4.11 on pages 99-100.
  4. Do exercise 4.14 on pages 101-102.
  5. Do exercise 4.15 on pages 103-104.

Chapter 3
  1. 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.
  2. Do exercise 3.4 on page 57.
  3. Do exercise 3.14 on page 70.
  4. Do exercise 3.15 on page 70.
  5. Do exercise 3.19 on page 72.

Chapter 2
  1. Do exercise 2.8 on page 38.
  2. Do exercise 2.11 on page 39.
  3. Do exercise 2.17 on page 44.
  4. Do exercise 2.18 on page 44.
  5. Do exercise 2.20 on pages 44-45.

Chapter 1
  1. Do exercise 1.6 on page 13.
  2. Do exercise 1.12 on page 18.
  3. 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.
  4. Write a Scheme procedure that will find the smallest of three integers.  What are some good test values for this procedure?
  5. 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.
    1. Write the Scheme expression to find the middle number of 17 and 5,678,200.
    2. Write a Scheme expression, called middle, that finds the middle number of any two numbers.
    3. 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