GATE / CS ARCHIVE

GATE CSE 2024 SET 2 / QUESTION 22

A two-state parity automaton

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

GATE 2024 Set 2, Q22 1 mark · MCQ
Report issue

Finite Automata

Question 22, GATE 2024: A DFA has start state E (nonaccepting) and state O (accepting). Input 0 loops at either state; input 1 switches E↔O. Which regex represents it? A 0*1(0+10*1)*; B 0*(10*11)*0*; C 0*1(010*1)*0*; D 0(1+0*10*1)*0*. Here + is union.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Approach: Assign a parity invariant to each state, then check the loop structure in the regex.

1. Derivation. It accepts exactly strings with an odd number of 1s. The initial 0*1 enters the accepting state; each following 0 stays there and each 10*1 makes a round trip through the other state. Therefore0*1(0+10*1)*, option A. B accepts epsilon, C cannot generate 111, and D requires an initial 0, so each differs.

2. Explanation and checks. After any prefix, E means an even number of ones and O means an odd number. In A, the leading 0*1 contributes the first one; each subsequent block contributes either zero ones or exactly two, preserving odd parity. Conversely, after the first one, any remaining ones can be paired, with intervening zeros accommodated by the blocks. The short strings ε, 111 and 1 distinguish B, C and D respectively from the required language.

Original paper, page 16 · Answer key