Question
Consider the pushdown automaton (PDA) P below, which runs on the input alphabet , has stack alphabet , and has three states , with being the start state. A transition from state to state , labelled , where is an input symbol or , is a stack symbol, and is a string of stack symbols, represents the fact that in state , the PDA can read from the input, with on the top of its stack, pop from the stack, push in the string on the stack, and go to state . In the initial configuration, the stack has only the symbol in it. The PDA accepts by empty stack.
Which one of the following options correctly describes the language accepted by P?
Official answer and solution
- Official answer
- A
- From
- Official GATE 2023 answer key
Solution
Trace stack pushes and pops for inputs and to determine the condition for empty-stack acceptance.
- The start state is with initial stack .
- On reading input :
- First : transition pushes on top of .
- Subsequent 's: self-loop pushes another for each .
So after reading (), the stack contains .
- On reading input :
- The PDA moves from to state via (consuming one and popping one ).
- Further 's loop at via , each consuming a and popping an .
So after reading , the stack contains .
- To reach empty stack:
- From or , the PDA transitions on to state (requiring at least one to be left on the stack when switching to , meaning ).
- At state , the PDA pops all remaining 's via and finally pops via , leaving the stack empty.
- Therefore, the PDA requires at least one () and strictly fewer 's than 's ().
Thus, .
Option (A)
Allowing , which prevents the transition to because no would remain to trigger it.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2023 Computer Science and Information Technology (CS)
- Question
- 40 of 65
- 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.