GATE Computer ScienceVery hardGATE CSE
Let L be the set of strings over {a, b} in which the third symbol from the right is a, or the last symbol is b (strings shorter than 3 satisfy only the second condition). How many states does the minimal complete DFA for L have?
- A. 9
- B. 6
- C. 8
- D. 7
Correct answer: D. 7
The DFA must remember the last 3 symbols plus whether the string is shorter than 3; collapsing equivalent histories by Moore partition refinement leaves 7 states.
More Theory of Computation questions
- An NFA over {a, b} has states 0–4, start state 0 and accepting state 4. Transitions: 0 –a→ {0,1}; 0 –b→ {0}; 1 –a,b→ {2}; 2 –a,b→ {3}; 3…
- A DFA over {a, b} has states 0–4, start 0 and accepting states {2, 4}. Transitions (on a, b): 0:(1,2), 1:(2,0), 2:(3,3), 3:(4,1), 4:(4,0)…
- Over {a, b}, L = { w : the number of a's in w is ≡ 1 (mod 4) and |w| ≡ 3 (mod 6) }. How many states does the minimal DFA of L have?
- A DFA over {0,1} has states p0 (start), p1, p2, A (accepting), D. Transitions: p0 –0,1→ p1; p1 –0,1→ p2; p2 –1→ A; p2 –0→ D; A –0,1→ A; D…
- How many strings of length 12 over {a, b} contain neither aba nor bbb as a substring?
- Consider the grammar S → aSbS | bS | ε over {a, b}. How many strings of length exactly 9 does it generate?