CMPSCI 501: Theory of Computation

Solutions to First Midterm Exam, Spring 2015

David Mix Barrington

18 February 2015

Question text is in black, solutions in blue.


  Q1: 10 points
  Q2: 10 points
  Q3: 10 points
  Q4: 10 points
  Q5: 10 points
  Q6: 15 points
  Q7: 10 points
  Q8: 10 points
  Q9: 15 points
  Q10: 10 points
  Q11: 10 points
  Q12: +10 points
 Total: 120+10 points

The language X over the alphabet {a, b, c} is the set {a1bjck: i + j = k}.

The language Y over the alphabet {a, b} is the set {anbncn: n ≥ 0}.

The language Z over the alphabet {a, b, c, d} is the language of the following NFA N. N has state set {0, 1, 2, 3}, start state and only final state 0, and transitions (0, a, 1), (0, a, 2), (1, b, 2), (1, b, 3), (2, c, 3), (2, c, 0), (3, d, 0), and (3, d, 1).

The PDA M has state set {i, p, f} with start state i and only final state f. Its input alphabet is {a, b} and its stack alphabet is {a, c}. Its transitions are (i, a, ε; p, c), (p, a, ε; p, a), (p, b, a; p, ε), and (p, b, c; f, ε). Recall that the transition (q, x, y; r, z) means that the PDA can do from state q to state r while reading x, popping y, and pushing z.

The grammar G has rules S → aTb, T → TT, T → aTb, and T → ε.

Last modified 22 February 2015