GATE Computer ScienceHardGATE CS

Let L = { w ∈ {a, b}* : |w| ≡ 0 (mod 3) and w contains ab as a substring }. How many states does the minimal complete DFA for L have?

  1. A. 12
  2. B. 8
  3. C. 9
  4. D. 6

Correct answer: C. 9

Three phases (no a yet, an a seen but no ab, ab seen) times three residues of |w| mod 3 give 9 states, and all of them are distinguishable.

More Theory of Computation questions

Exams that ask this topic