GATE Computer ScienceVery hardGATE CS (PYQ pattern)
L = { w ∈ {a, b}* : n_a(w) ≡ 1 (mod 3) or w contains bb as a substring }. The minimal complete DFA has how many states?
- A. 7
- B. 6
- C. 9
- D. 12
Correct answer: A. 7
While no bb has occurred, track (n_a mod 3, last symbol is b): 3 × 2 = 6 states; once bb occurs the string is accepted forever, adding an accepting sink: 7.
More Theory of Computation questions
- L = { w ∈ {a, b} : |w| ≥ 2 and the first symbol differs from the last symbol }. How many states does the minimal complete DFA for L have?
- L = { w ∈ {a, b} : w[i] = w[i+3] for every valid index i } (w is periodic with period 3). How many states does the minimal complete DFA…
- L = { w ∈ {a, b} : any two a's in w are separated by at least two b's }. How many states does the minimal complete DFA for L have?
- L = { w ∈ {a, b} : any two a's in w are separated by at least two b's, and w ends with b }. How many states does the minimal complete DFA…
- L = { w ∈ {a, b} : |w| is even and the last two symbols of w differ }. How many states does the minimal complete DFA for L have?
- L = { w ∈ {a, b} : w contains aab as a substring, or w ends with ba }. How many states does the minimal complete DFA have?