Question
Consider the NPDA , where (as per usual convention) is the set of states, is the input alphabet, is the stack alphabet, is the state transition function, is the initial state, is the initial stack symbol, and is the set of accepting states. The state transition is as follows:
Which one of the following sequences must follow the string so that the overall string is accepted by the automaton?
Official answer and solution
- Official answer
- B
- From
- Official GATE 2015 answer key
Solution
Trace the push and pop operations of the NPDA for each stage to determine the matching suffix.
-
Automaton behavior:
- In state :
Input 1 pushes 1:
Input 0 pushes 0: - Transition :
On , stack is unchanged: . This corresponds to the midpoint symbol or boundary between halves. - In state :
Input 0 pops 1 from stack top:
Input 1 pops 0 from stack top:
Each bit read in pops its complement from the stack. - Transition :
empties the initial stack marker and accepts.
- In state :
-
Tracing the prefix :
All candidate options are 5 bits long, making the total string length bits.
In an 11-bit string accepted via an odd-length transition with center symbol , the first 5 bits are pushed in , the 6th bit is the center symbol read on transition , and the remaining 5 bits pop the stack in :- Prefix of 5 bits: .
- Pushing onto the stack yields (bottom to top): .
- 6th bit is : read by the transition without altering the stack.
- Now in state , to completely empty the stack to , the input bits must pop elements in order:
- Stack top is 0 -> requires input 1 to pop.
- Stack top is 1 -> requires input 0 to pop.
- Stack top is 1 -> requires input 0 to pop.
- Stack top is 0 -> requires input 1 to pop.
- Stack top is 1 -> requires input 0 to pop.
-
Resulting sequence:
The sequence of bits required to pop the stack is .
This matches option B.
B
Treating the NPDA as an ordinary palindrome acceptor instead of noticing that q1 pops the complement bit (0 pops 1, and 1 pops 0).
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2015 Computer Science and Information Technology (CS) Session 1
- Question
- 61 of 65, printed as CS Q.51
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.