Consider the following language. L = {x ∈ {a, b}*| number of a's in x is divisible by 2 but not divisible by 3} The minimum number of states in a DFA that accepts L is …
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2020 · Q51
Time
Your answerNumerical answer
Solution
Official answer: 6
Regular Expressions and Finite AutomataLet denote the number of occurrences of symbol '' in string .
The condition states:
is divisible by 2
is not divisible by 3 $\implies n_a(x)
ot\equiv 0 \pmod 3$
Consider the count of 's modulo :
Divisible by 2:
Not divisible by 3:
The intersection is .
Thus, the DFA must track , requiring 6 states (corresponding to remainders ). By the Myhill-Nerode theorem, strings are mutually distinguishable, so no states can be merged.
Therefore, the minimum number of states in the DFA is 6.
Try the question first, then check your work.
Examiner trap
The divisibility condition depends on . Consider the remainders of the number of 's modulo 6.
This Regular Expressions and Finite Automata previous year question is Q51 of the GATE CSE 2020 paper. Find more GATE CSE PYQs on Regular Expressions and Finite Automata in Theory of Computation, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Regular Expressions and Finite Automata PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Regular Expressions and Finite Automata has 41 GATE CSE PYQs across 24 papers from 2011 to 2026. 6 of them are 2-mark NAT questions like this one, and GATE CSE 2020 has 2.
How GATE tests Regular Expressions and Finite AutomataIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.