GATE / CS ARCHIVE

GATE CSE 2021 SET 1 / QUESTION 38

GATE CSE 2021 Set 1 Q38

Theory of Computation · Finite Automata · Full GATE CSE 2021 Set 1 paper

GATE 2021 Set 1, Q38 2 marks · MCQ
Report issue

Finite Automata

Question 38, GATE 2021: Which DFA recognizes exactly binary strings ending in 011? Essential transition-table descriptions of the four diagrams: all have states q0,q1,q2,q3, start q0, only q3 accepting. Common transitions: q0 on 0→q1 and on 1→q0; q1 on 0→q1 and on 1→q2; q2 on 0→q1 and on 1→q3. The differing q3 transitions (on 0,on 1) are A (q1,q3); B (q3,q3); C (q1,q2); D (q1,q0).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Label the four states by the longest suffix matching a prefix of 011: ε, 0, 01, 011. Their transitions on(0, 1) are respectively(0,ε),(0, 01),(0, 011),(0,ε). Only the 011 state accepts. These transitions are exactly D. A wrongly accepts 0111, B keeps accepting after arbitrary suffixes, and C accepts 01111 despite its final three symbols being 111.

The invariant is that the state remembers the longest suffix of the input that is also a prefix of the target 011. After reading 0111 there is no nonempty suffix that is such a prefix, so the accepting state's 1-transition must return to q0. After reading 0110, the suffix 0 remains useful, so its 0-transition must go to q1. These two checks distinguish D from the three other diagrams while the invariant proves correctness for arbitrary input lengths.

Original paper, page 32 · Answer key