Push-down Automata · Theory of Computation
10 questions · asked in 9 of 27 years (2000–2026)
MCQ 9 · NAT 11-mark 6 · 2-mark 4
2000Questions per year2026
Questions 6–10 of 10
Consider the pushdown automaton (PDA) below which runs over the input alphabet (a, b, c). It has the stack alphabet where is the bottom-of-stack marker. The set of states of the PDA is (s, t, u, f} where s is the start state and f is the final state. The PDA accepts by final state. The transitions of the PDA given below are depicted in a standard manner. For example, the transition means that if the PDA is in state s and the symbol on the top of the stack is X, then it can read b from the input and move to state t after popping the top of stack and pushing the symbols and X (in that order) on the stack.
The language accepted by the PDA is
The language accepted by the PDA is
Answer: (C)
Follow the stack and count the symbols .
In state s, each adds two : and both add a net two. The first moves s to t and pops one . Each later , in t, pops one . So the b's come after the a's. The first moves t to u and pops one , and each later , in u, pops one . So the c's come after the b's. The input has the form .
For a non-empty string, the PDA reaches only from state u with on top, that is, when every has been popped. It pushed X's and popped , so . The X's from the a's can be used by any mix of b's and c's. It is not one a for one b and one a for one c.
Check with : . The stack gets four X's, the b pops one, and the three c's pop the other three, so the string is accepted and . Here and , so it is not in A (), B () or D ().
Answer: (C)
In state s, each adds two : and both add a net two. The first moves s to t and pops one . Each later , in t, pops one . So the b's come after the a's. The first moves t to u and pops one , and each later , in u, pops one . So the c's come after the b's. The input has the form .
For a non-empty string, the PDA reaches only from state u with on top, that is, when every has been popped. It pushed X's and popped , so . The X's from the a's can be used by any mix of b's and c's. It is not one a for one b and one a for one c.
Check with : . The stack gets four X's, the b pops one, and the three c's pop the other three, so the string is accepted and . Here and , so it is not in A (), B () or D ().
Answer: (C)
Which of the following languages is accepted by a non-deterministic pushdown automaton (PDA) but NOT by a deterministic PDA?
Answer: (B)
B can be accepted by an NPDA. The NPDA guesses which condition fails. Branch 1 checks : push the a's, pop one a for each b, and accept if a's are left over or b's run out of a's. Branch 2 checks : skip the a's, push the b's, pop one b for each c, and accept if b's are left over or c's are extra. The state keeps the order a, b, c. A DPDA cannot guess, so it cannot do both comparisons on the same input.
B cannot be accepted by a DPDA. Suppose a DPDA accepts the language L of B. The class of deterministic CFLs is closed under complement, so the complement of L is also a DCFL. Intersecting a DCFL with a regular language gives a CFL. Take the regular language . A string of this form is outside L exactly when and . So would be a CFL. It is not (pumping lemma for CFLs). So no DPDA accepts L.
The other options:
A: is not context-free, so no PDA of any kind accepts it.
C: a DPDA pushes a's and pops one per b.
D: is regular, so a DFA, and hence a DPDA, accepts it.
Answer: (B)
B cannot be accepted by a DPDA. Suppose a DPDA accepts the language L of B. The class of deterministic CFLs is closed under complement, so the complement of L is also a DCFL. Intersecting a DCFL with a regular language gives a CFL. Take the regular language . A string of this form is outside L exactly when and . So would be a CFL. It is not (pumping lemma for CFLs). So no DPDA accepts L.
The other options:
A: is not context-free, so no PDA of any kind accepts it.
C: a DPDA pushes a's and pops one per b.
D: is regular, so a DFA, and hence a DPDA, accepts it.
Answer: (B)
Let P be a non-deterministic push-down automaton (NPDA) with exactly one state, q, and exactly one symbol, Z, in its stack alphabet. State q is both the starting as well as the accepting state of the PDA. The stack is initialized with one Z before the start of the operation of the PDA. Let the input alphabet of the PDA be . Let L(P) be the language accepted by the PDA by reading a string and reaching its accepting state. Let N(P) be the language accepted by the PDA by reading a string and emptying its stack. Which of the following statements is TRUE?
Answer: (D)
A PDA need not have a move for every input symbol and stack top. Take the PDA with no transitions at all, and let have at least one symbol.
L(P): q is the start state and also accepting, so the empty string is accepted. A non-empty string cannot be read, because there is no move. So .
N(P): the stack starts with Z and never changes, so it is never empty. So .
This one PDA shows that neither language is necessarily . So A, B and C, which each claim that at least one of them necessarily is , are false. It is tempting to say "q is accepting, so L(P) is everything", but a string is accepted only if the PDA can read all of it, and that needs a move for each symbol.
Answer: (D)
L(P): q is the start state and also accepting, so the empty string is accepted. A non-empty string cannot be read, because there is no move. So .
N(P): the stack starts with Z and never changes, so it is never empty. So .
This one PDA shows that neither language is necessarily . So A, B and C, which each claim that at least one of them necessarily is , are false. It is tempting to say "q is accepting, so L(P) is everything", but a string is accepted only if the PDA can read all of it, and that needs a move for each symbol.
Answer: (D)
Let be a pushdown automaton, where
Which one of the following strings is not a member of L(M)?
Which one of the following strings is not a member of L(M)?
Answer: (D)
Read as: in state p, read u, pop , go to q, push . A string is accepted if the PDA can read all of it and end in the final state f.
In s, any a or b that is read pushes one a (the first two transitions). The only other move from s is on an input a with an a on the stack: it pops that a and goes to f. In f, every a or b read pops one a. The state f can be reached only through that move.
So a string is accepted exactly when it can be written as , where x is the part pushed, the a is the move to f, and y is the rest. The stack holds a's, the middle a pops one, and each symbol of y pops one more, so we need .
aaa: . Accepted.
aabab: , and . Accepted.
baaba: . Accepted.
bab: the only a is the middle one, so and . After that a pops the only pushed a, the stack is empty and the last b has nothing to pop. Every other path ends in s, which is not final. So bab is rejected.
Answer: (D)
In s, any a or b that is read pushes one a (the first two transitions). The only other move from s is on an input a with an a on the stack: it pops that a and goes to f. In f, every a or b read pops one a. The state f can be reached only through that move.
So a string is accepted exactly when it can be written as , where x is the part pushed, the a is the move to f, and y is the rest. The stack holds a's, the middle a pops one, and each symbol of y pops one more, so we need .
aaa: . Accepted.
aabab: , and . Accepted.
baaba: . Accepted.
bab: the only a is the middle one, so and . After that a pops the only pushed a, the stack is empty and the last b has nothing to pop. Every other path ends in s, which is not final. So bab is rejected.
Answer: (D)
The language accepted by a Pushdown Automaton in which the stack is limited to 10 items is best described as
Answer: (B)
Correct Option: B
The stack can hold only a limited number of items, so the number of possible configurations is finite. Each of these configurations can be treated as a state of a finite automaton.
Keep practising