GATE Computer ScienceVery hardGATE CS (PYQ pattern)

L = { w ∈ {a, b}* : |w| mod 4 = 1 AND w ends with bb }. How many states does the minimal complete DFA for L have?

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

Correct answer: A. 6

The last two symbols only matter at the two positions before an accepting length: at length ≡ 0 (mod 4) remember whether the last symbol was b, and at length ≡ 1 accept iff the new symbol is b. States: lengths ≡ 1 (non-accepting), 2, 3, ≡ 0 with last ≠ b, ≡ 0 with last b, and the accepting ≡ 1 state — 6, not the 4 × 3 = 12 product.

More Theory of Computation questions

Exams that ask this topic