Consider the following deterministic finite automaton (DFA). The number of strings of length 8 accepted by the above automaton is …
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2021 Set 2 · Q17
Time

Your answerNumerical answer
Solution
Official answer: 256
Regular Expressions and Finite AutomataLet us trace the DFA from the start state :
Step 1 (Length 1): On reading the first symbol ( or ), the automaton transitions from the start state to one of the two level-1 states.
Step 2 (Length 2): On reading the second symbol ( or ), transitions from any level-1 state lead to one of the two level-2 states.
Step 3 (Length 3): On reading the third symbol ( or ), every transition from either level-2 state leads to the single final/accepting state (with the double circle).
Steps 4 to 8: The final state has a self-loop on both input symbols . Once reached, the automaton remains in the accepting state for any subsequent symbol.
Thus, every binary string of length is accepted by this DFA.
The total number of binary strings of length 8 is:
Since all of them are accepted, the answer is 256.
Try the question first, then check your work.
Examiner trap
Trace the transitions step-by-step: observe that after reading any sequence of 3 symbols, the automaton always enters the final state with a self-loop on all inputs.
This Regular Expressions and Finite Automata previous year question is Q17 of the GATE CSE 2021 Set 2 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. 5 of them are 1-mark NAT questions like this one, and GATE CSE 2021 Set 2 has 3.
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.