Consider the following language. L = {w ∈ {0, 1}* w ends with the substring 011} Which one of the following deterministic finite automata accepts L?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2021 Set 1 · Q38
Time
Select one answerSingle correct
Solution
Official answer: D)
Regular Expressions and Finite AutomataTo design a minimal DFA that accepts all strings ending with the substring , we define states representing the longest suffix of the input read so far that is a prefix of [1]:
State (Start state): Represents suffix (no prefix of matched).
State : Represents suffix .
State : Represents suffix .
State (Accept state): Represents suffix .
Let us determine the transitions for each state:
From :
On (suffix becomes )
On (suffix remains )
From (suffix ):
On (suffix remains )
On (suffix becomes )
From (suffix ):
On (suffix becomes )
On (suffix becomes )
From (suffix ):
On : Suffix becomes . The longest suffix of that is a prefix of is , so it must transition to .
On : Suffix becomes . The longest suffix of that is a prefix of is , so it must transition back to the start state .
Evaluating the options based on transitions from :
(A) has a self-loop on at , so it would incorrectly accept strings ending in .
(B) has a self-loop on at , which accepts any string containing as a substring.
(C) has a transition on from to , which would incorrectly accept .
(D) correctly transitions on to and on to .
Thus, option D is the correct DFA [1].
Try the question first, then check your work.
Examiner trap
Track the longest suffix that matches a prefix of after reading each input symbol from the accepting state ( and ).
This Regular Expressions and Finite Automata previous year question is Q38 of the GATE CSE 2021 Set 1 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. 10 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2021 Set 1.
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.