GATE Computer ScienceVery hardGATE CS (PYQ pattern)
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 complete DFA for L have?
- A. 8
- B. 9
- C. 16
- D. 11
Correct answer: D. 11
Read the first two symbols (ε, a, b: 3 classes), remember the 2nd symbol s, then track the last two symbols to know the 2nd-from-right and the next one: for each s, 4 windows (the window decides acceptance and the future). 3 + 2 × 4 = 11; nothing merges because both values of s are reachable with every window.
More Theory of Computation questions
- 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?
- 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?