CMPSCI 250: Introduction to Computation

Solutions to Second Midterm Exam

David Mix Barrington

25 October 2007

Directions:

Question text is in black, solutions in blue.

  Q1: 20 points
  Q2: 20 points
  Q3: 20 points
  Q4: 20 points
  Q5: 20 points plus 10 extra credit
 Total: 100 points plus 10 extra credit

Questions 1 and 2 deal with the Fibonacci sequence from Discussion #5. Recall that the function F from naturals to naturals is defined recursively, by the rules F(0) = 0, F(1) = 1, and (for n > 1) F(n) = F(n-1) + F(n-2). As we calculated in the discussion, F(2) = 1, F(3) = 2, F(4) = 3, and F(5) = 5.