GATE / CS ARCHIVE

GATE CSE 2009 / QUESTION 41

DFA accepting a two-zero suffix

Theory of Computation · Finite Automata · Full GATE CSE 2009 paper

GATE 2009, Q41 2 marks · MCQ
Report issue

Finite Automata

Question 41, GATE 2009: A DFA starts q0, accepts only q2. On 0, q0→q1→q2→q2; on 1, all states go q0. What does it accept? A strings beginning 0 or 1; B ending 0; C ending 00; D containing 00.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

The states record zero, one, or at least two consecutive zeros at the end. Every 1 returns to the start state; 0 advances to the accepting state after the second consecutive zero, where further zeros loop. Hence exactly strings ending 00 are accepted, C, rather than all strings that merely contain 00 somewhere.

The state records the length of the current suffix of consecutive zeros, capped at 2. Reading 1 resets that suffix to length 0. Reading a second consecutive 0 reaches q2; additional zeros stay accepting. A string such as 001 contains 00 but ends in 1 and is rejected, separating C from D. A single 0 reaches q1 and is rejected, separating C from B.

Original paper, page 9