GATE Computer ScienceHardGATE CS (PYQ pattern)

L = { w ∈ {a, b}* : (n_a(w) − n_b(w)) is divisible by 3 and w contains no bb }. Its minimal complete DFA has 7 states. How many of them are accepting?

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

Correct answer: C. 2

Live states are (difference mod 3, last symbol b?) — 6 combinations, plus dead. Difference 0 occurs with last symbol not b (e.g. ε) and with last symbol b (e.g. ab); both are accepting and they differ (suffix b kills only the second). The other residues are rejecting. So 2 accepting states.

More Theory of Computation questions

Exams that ask this topic