- GATE CS
- 2026–27 pattern practice
- Theory of Computation
- Finite automata
- Medium
How many states does the minimal DFA have for the language of strings over {a, b} containing exactly two a's?
Regular Languages
Pick an option to check your answer.
Answer: D. Solution
The DFA counts a's: 0 seen, 1 seen, 2 seen (accepting), and more than 2 (a dead state that can never accept). All four behave differently on future input, so the minimal DFA has 4 states.
Why not the others
- omits the dead state needed after a third a.
- adds a state equivalent to an existing one.
- cannot count up to two.