CMPSCI 250: Introduction to Computation

Second Midterm Exam Spring 2017

David Mix Barrington

4 April 2017


  Q1: 30+10 points
  Q2: 40 points
  Q3: 30 points
Total: 100+10 points

Here are definitions of some terms, sets, predicates, and statements used on this exam.

Remember that the scope of any quantifier is always to the end of the statement it is in.

Remember that a natural is a non-negative integer, so that the set N or all naturals is {0, 1, 2, 3,...}.

The Fibonacci numbers are a sequence of naturals defined by the rules F(0) = 0, F(1) = 1, and, for all n with n ≥ 1, F(n+1) = F(n) + F(n-1).

A binary string is a string over the alphabet {0, 1}.

A winning strategy for one player in a two-person, zero-sum game is a way for that player to choose moves such that they are guaranteed a positive payoff at the end of the game no matter how their opponent moves.

The two-player game of Tic-Tac-Toe is played on a three-by-three grid of squares. Each player in turn places one of their markers in a vacant square, until either (1) one player gets three markers in a row, and thus wins, or (2) there are no vacant squares left, and the game is a draw.

Cardie's game begins with a single stick whose length in centimeters is a positive natural. A move in the game is for Cardie to choose a stick whose length is even and break it into two sticks of equal length. The game ends when there are no sticks remaining with even length.

The directed graph below represents an imagined neighborhood of San Francisco, where our three commuters live at node s and want to travel to their workplace at node g. Two-way edges in this graph represent level roads, and one-way edges represent sloped roads, with the edge pointing downhill. Beatriz can traverse a downhill edge in one minute, a level edge in two minutes, or an uphill edge in five minutes.

Directed graph for an imagined neighborhood of San Francisco:

(a) <---------> (b) <---------> (c)
 ^               ^               ^
 |               |               |
 |               |               |
 |               |               |
 v               |               v
(d) <---------- (e) ----------> (g)
 ^               ^               ^
 |               |               |
 |               |               |
 |               |               |
 |               |               |
(s) <---------- (f) ----------> (h)

Last modified 17 April 2017