GATE Computer ScienceHardGATE CS

Let L = { w ∈ {a, b}* : w contains at most 3 a's and at least 2 b's }. How many states does the minimal complete DFA for L have?

  1. A. 13
  2. B. 20
  3. C. 15
  4. D. 12

Correct answer: A. 13

Track (a-count 0..3, b-count capped at 2): 4 × 3 = 12 live states, all distinguishable. A fourth a kills the string for good, so one extra dead state gives 13; the naive 5 × 3 = 15 forgets that every state with a-count 4 is the same dead state.

More Theory of Computation questions

Exams that ask this topic