GATE Computer ScienceVery hardGATE CS (PYQ pattern)

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

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

Correct answer: B. 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