GATE / CS ARCHIVE

GATE CSE 2021 SET 2 / QUESTION 17

GATE CSE 2021 Set 2 Q17

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

GATE 2021 Set 2, Q17 1 mark · NAT
Report issue

Finite Automata

Question 17, GATE 2021: DFA has start q0, layer-one states u,v, layer-two states p,q and accepting f. Transitions: q0:0→u,1→v; u:0→p,1→q; v:0→p,1→q; p and q:0,1→f; f:0,1→f. Count accepted strings of length 8.
Tap to enlarge
Answer & solution

Official answer: 256

Every input follows one edge through each of the first three layers, reaching the accepting state after exactly three symbols regardless of their values. That state loops on both 0 and 1. Hence every eight-bit string is accepted, giving 2⁸=256.

The machine recognizes all binary strings of length at least three: no earlier state is accepting, and after the third transition it cannot leave f. Thus for any length n≥3 the count is 2n. The two layer-two branches must not be mistaken for missing-input transitions; each accepts both bits on the next step.

Original paper, page 64 · Answer key