GATE / CS ARCHIVE

GATE CSE 2015 SET 1 / QUESTION 50

GATE CSE 2015 Set 1 Q50

Theory of Computation · Pushdown Automata · Full GATE CSE 2015 Set 1 paper

GATE 2015 Set 1, Q50 2 marks · MCQ
Report issue

Pushdown Automata

Question 50, GATE 2015: NPDA states q0(start),q1,q2(final), stack bottom ⊥. At q0 read b∈{0,1} and push b; transition to q1 may consume 0,1,or ε without changing stack. At q1 read 0 and pop 1, or read 1 and pop 0. With only ⊥ left, ε-pop it and enter q2. Which suffix appended to 101100 is accepted? A 10110; B 10010; C 01010; D 01001.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

The push phase remembers a prefix in reverse order; the pop phase checks its complemented reverse. Thus accepted strings have form w z complement(reverse(w)), where z is empty or one symbol. Every listed concatenation has eleven symbols, forcing |w|=5 and one middle symbol. Here w=10110, middle=0, and reverse(w)=01101. Complementing gives 10010. The nondeterministic phase switch is constrained by total length, so one cannot push all six supplied prefix bits.

Solution: The NPDA pushes a prefix, optionally consumes a middle symbol while changing phase, then pops only on the complementary symbol. The full listed strings have length 11, so the first five symbols 10110 are pushed and the sixth 0 is the middle. The remaining five must be the complement of the reversed prefix: reverse 10110=01101, complement 10010. Thus B.

Original paper, page 18 · Answer key