GATE / CS ARCHIVE

GATE CSE 2008 / QUESTION 52

Matching four NFAs to regular expressions

Theory of Computation · Regular Expressions & Languages · Full GATE CSE 2008 paper

GATE 2008, Q52 2 marks · MCQ
Report issue

Regular Expressions & Languages

Question 52, GATE 2008: Match four NFAs to regular expressions. Each NFA has lower state L (initial and accepting), upper-left A and upper-right B. Unlisted transitions are absent. P: L−0→A, A−0→L and B, B−1→A and B; B is also accepting. Q: L−0→A, A−0→L, A−1→B, B−1→A, B−0→B; only L accepts. R: L−0→A, A−1→L and B, B−1→A, B−0→B; only L accepts. S has R’s transitions with both L and B accepting. Expressions: 1: ε+0(01*1+00)*01*; 2: ε+0(10*1+00)*0; 3: ε+0(10*1+10)*1; 4: ε+0(10*1+10)*10*.

(A) P–2,Q–1,R–3,S–4
(B) P–1,Q–3,R–2,S–4
(C) P–1,Q–2,R–3,S–4
(D) P–3,Q–2,R–1,S–4
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Name the lower start state L, upper-left state A and upper-right state B. Every automaton accepts ε at L; every nonempty accepted path begins with 0 from L to A. In P, cycles from A back to A are 00 via L or 01*1 via B, and a finishing path to either accepting state is represented by 01*.
2. Hence P matches expression 1: ε+0(01*1+00)*01*. In Q, the A-cycles are 00 or 10*1, with final 0 to L, giving expression 2. In R, the A-cycles are 10 or 10*1, with final 1 to L, giving expression 3.
3. In S, the same cycles apply but B is also accepting, so a final 10* covers both possible accepting destinations, giving expression 4. Thus P–1,Q–2,R–3,S–4, option C.

Original paper, page 10