CMPSCI 401: Theory of Computation

First Midterm Exam Solutions, Spring 2010

David Mix Barrington

22 February 2010

Question text is in black, solutions in blue.

Directions:

  Q1: 10 points
  Q2: 10 points
  Q3: 10 points
  Q4: 10 points
  Q5: 35+10 points
  Q6: 20 points (note the exam paper said "30" here)
  Q7: 30 points

  Total: 125+10 points

Several questions refer to the following PDA called P. P has state set {q0, q, f}, start state q0, final state set {f}, input alphabet {a, b}, and stack alphabet {$, c}. It has six transitions: (q0, ε, ε; q, $), (q, a, ε; q, c), (q, b, ε; q, c), (q, a, c; q, ε), (q, b, c; q, ε), and (q, ε, $; f, ε). (Remember that a transition (p, a, b; q, c) means that the machine may go from state p to state q reading a from the input, popping b, and then pushing c.)

The grammar G is given by the rule set S --> SS | aSa | aSb | bSa | bSb | ε. It was defined on the test paper but was left off of this page until I discovered the error in February 2011. (DAMB)

Last modified 13 February 2011