GATE Computer ScienceModerateGATE CSE

Over {a, b}, let L = { w : the number of a's in w is ≡ 1 (mod 3) and w ends with b }. How many states does the minimal complete DFA for L have?

  1. A. 4
  2. B. 3
  3. C. 5
  4. D. 6

Correct answer: A. 4

The last-symbol flag matters only when n_a ≡ 1 (mod 3). States: residue 0, residue 2, (residue 1, last is b) and (residue 1, last is not b), so 4 states, not 6.

More Theory of Computation questions

Exams that ask this topic