GATE Computer ScienceVery hardGATE CS (PYQ pattern)

An NFA over {a, b} has states 0, 1, 2, 3, start state 0 and accepting set {1}. Transitions: δ(0): a→{0,1}, b→{1}; δ(1): a→{0,1,2,3}, b→∅; δ(2): a→∅, b→{1,3}; δ(3): a→{2}, b→{1,2}. How many of the 32 strings of length 5 over {a, b} does it accept?

  1. A. 20
  2. B. 24
  3. C. 17
  4. D. 16

Correct answer: A. 20

Convert to a DFA (subset construction with ε-closure) and run all 32 strings of length 5: 20 end in an accepting subset. Counting accepting paths instead of strings would overcount.

More Theory of Computation questions

Exams that ask this topic