GATE Computer ScienceHardGATE CS (PYQ pattern)
How many states does the minimal complete DFA for { w ∈ {a, b}* : ab occurs EXACTLY twice as a substring } have?
- A. 5
- B. 7
- C. 6
- D. 8
Correct answer: B. 7
Track the count 0, 1, 2 and whether the last symbol is a (an ab can complete next): 3 × 2 = 6 states, plus a dead state once a third ab appears. Both count-2 states accept and differ (suffix b kills one). 7 states.
More Theory of Computation questions
- L = { w ∈ {a, b} : #ab(w) ≡ #ba(w) (mod 3) }, where #ab and #ba count occurrences of these substrings. How many states does the minimal…
- L = { w ∈ {a, b} : |w| ≥ 2 and the 2nd symbol from the left equals the 2nd symbol from the right }. How many states does the minimal…
- L = { w ∈ {a, b} : na(w) ≡ 1 (mod 3) or w contains bb as a substring }. The minimal complete DFA has how many states?
- 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?