GATE / CS ARCHIVE

GATE CSE 2012 / QUESTION 46

Complete DFA avoiding three consecutive zeros

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

GATE 2012, Q46 2 marks · MCQ
Report issue

Finite Automata

Question 46, GATE 2012: Complete a DFA for binary strings in which every length-three substring has at most two zeros (so 000 is forbidden). All strings shorter than three are accepted. States ε (initial),0,1,00,01,10,11 are accepting; q is rejecting. Existing transitions: ε--0→0, ε--1→1, 0--0→00, 0--1→01, 1--0→10, 1--1→11, 01--0→10, 10--1→01, 11--1→11, q--0,1→q. Which list supplies the missing arcs? Each triple means (source,input,target).
(A) (00,1,00),(00,0,01),(01,1,11),(10,0,00),(11,0,10).
(B) (00,0,01),(00,1,q),(01,1,01),(10,0,11),(11,0,01).
(C) (00,1,01),(00,0,q),(01,1,01),(10,0,10),(11,0,01).
(D) (00,1,01),(00,0,q),(01,1,11),(10,0,00),(11,0,10).
Tap to enlarge
Your answer
Answer & solution

Official answer: D

The forbidden length-three substring is exactly 000. The two-symbol states retain the last two symbols until the rejecting sink q is reached. Missing transitions are δ(00, 0)=q, δ(00, 1)=01, δ(01, 1)=11, δ(10, 0)=00, and δ(11, 0)=10. These are precisely table D. Every nonsink state accepts, including the states for strings shorter than three symbols.

Check: Appending 0 to suffix 00 creates forbidden 000, requiring the sink. Appending 1 to 00 leaves suffix 01; appending 1 to 01 leaves 11; appending 0 to 10 leaves 00; appending 0 to 11 leaves 10. This derives every missing arc rather than matching only one table entry.

Original paper, page 11 · Answer key