Machine-translated by Google. Questions are authored in English.
Top

Pushdown Automata Questions and Answers

1.

Consider the transition diagram of a PDA given below with input alphabet \(\Sigma = \{a, b\}\) and stack alphabet \(\Gamma = \{X, Z\}\). \(Z\) is the initial stack symbol. Let \(L\) denote the language accepted by the PDA.

PDA with three states. The start state is accepting and loops on a,X/XX and a,Z/XZ; on b,X/epsilon it moves to a second state, which loops on b,X/epsilon and moves on epsilon,Z/Z to a third, accepting state

Which one of the following is TRUE?

Exam Year(s)

GATE CS - 2016,

Answer: D

The true statement is \(L = \{a^{n} \mid n \ge 0\} \cup \{a^{n}b^{n} \mid n \ge 0\}\) and is deterministic context-free.

The start state is accepting and pushes one X for each a, so any string of a's alone, including the empty string, ends in an accepting state: that gives \(a^{n}\). On the first b the PDA pops an X and moves to the middle state, which pops one X per further b. When the stack is back to Z it takes the \(\varepsilon\) move to the final accepting state. So a's followed by an equal number of b's are accepted: \(a^{n}b^{n}\).

At every point there is at most one move for each combination of state, input and stack top, and the \(\varepsilon\) move on Z does not compete with any input move on Z. The PDA is deterministic, so \(L\) is deterministic context-free, which rules out the option saying no DPDA accepts it. \(L\) is not just \(\{a^{n}b^{n}\}\), since strings like aa are accepted, and every context-free language is decided by some halting Turing machine.

Please log in or register to report this question.

2.

Which ONE of the following languages is accepted by a deterministic pushdown automaton?

Exam Year(s)

GATE CS - 2025,

Answer: A

A deterministic pushdown automaton can accept any regular language.

Every regular language has a deterministic finite automaton, and a DPDA can simulate a DFA by simply never using its stack. So every regular language is a deterministic context-free language.

The reverse does not hold for the other classes. Some context-free languages, such as even-length palindromes, need nondeterminism (the machine must guess the middle), so not every context-free language, or every language of a nondeterministic PDA, is accepted by a DPDA. Decidable languages include non-context-free ones such as anbncn, which no pushdown automaton accepts.

Please log in or register to report this question.

3.

Consider the pushdown automaton (PDA) \(P\) below, which runs on the input alphabet \(\{a, b\}\), has stack alphabet \(\{\bot, A\}\), and has three states \(\{s, p, q\}\), with \(s\) being the start state. A transition from state \(u\) to state \(v\), labelled \(c/X/\gamma\), where \(c\) is an input symbol or \(\epsilon\), \(X\) is a stack symbol, and \(\gamma\) is a string of stack symbols, represents the fact that in state \(u\), the PDA can read \(c\) from the input, with \(X\) on the top of its stack, pop \(X\) from the stack, push in the string \(\gamma\) on the stack, and go to state \(v\). In the initial configuration, the stack has only the symbol \(\bot\) in it. The PDA accepts by empty stack.

PDA with states s, p and q and transitions labelled input/pop/push, as described in the stem

Which one of the following options correctly describes the language accepted by \(P\)?

Exam Year(s)

GATE CS - 2023,

Answer: A

The language is \(\{a^{m}b^{n} \mid 1 \le m \text{ and } n \lt m\}\).

In state s each a pushes an A, so after \(a^{m}\) the stack holds m A's above \(\bot\). Each b in state p pops one A. To empty the stack the PDA must reach q, where it can pop all remaining A's and finally \(\bot\). But both moves into q, from s or from p, need an A on top of the stack.

  • With no a's (m = 0) the top is \(\bot\) and q is unreachable, so \(m \ge 1\).
  • After n b's, \(m - n\) A's remain; moving to q needs at least one, so \(n \lt m\). With n = m the stack shows \(\bot\) in p and the PDA is stuck.

\(0 \le n \le m\) wrongly allows n = m and m = 0, the empty string included. \(0 \le m, 0 \le n\) has no relation between the counts at all. Strings of b's alone cannot be accepted, since b needs an A to pop, which rules out the last option.

Please log in or register to report this question.

4.

Which of the following conversions is not possible algorithmically ?

Exam Year(s)

MH SET - 2018, SET Exam - 2018,

Answer: D

The conversion that is not possible is Non-deterministic PDA to deterministic PDA.

Non-deterministic pushdown automata accept all context-free languages, but deterministic PDAs accept only the deterministic context-free languages, a proper subset. For example the language of even-length palindromes needs non-determinism, so no algorithm can convert every NPDA into an equivalent DPDA.

The other conversions are always possible: a regular grammar already is a context-free grammar; the subset construction converts an NFA to a DFA; and a deterministic Turing machine can simulate a non-deterministic one by trying all branches.

Please log in or register to report this question.

5.

For which context free languages below, we can construct an equivalent PDA with one (1) stack :

(i) \(L = \{a^{n}b^{n}c^{n} / n \ge 1\}\)
(ii) \(L = \{a^{n}b^{n} / n \ge 1\}\)
(iii) \(L = \{a^{n}b^{2n} / n \ge 1\}\)

Exam Year(s)

MH SET - 2019, SET Exam - 2019,

Answer: B

A single-stack PDA exists for (ii) and (iii) only.

For \(a^{n}b^{n}\), the PDA pushes a symbol for each a and pops one for each b, accepting when the stack empties as the input ends. For \(a^{n}b^{2n}\), it pushes two symbols for each a (or pops one for every two bs) in the same way. Both are context-free.

\(a^{n}b^{n}c^{n}\) is the standard example of a language that is not context-free: after the stack has been used to match the as against the bs, nothing remains to check the cs. The pumping lemma for context-free languages proves this, so no PDA with one stack accepts it, and options including (i) are wrong.

Please log in or register to report this question.

6.

In a pushdown automaton, which additional feature distinguishes it from a finite automaton ?

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: B

A pushdown automaton is distinguished by its stack memory.

A PDA is a finite automaton with an unbounded stack. It can push and pop symbols, which lets it match nested structures and counts such as anbn or balanced brackets. This is why it accepts the context-free languages.

A finite automaton already has multiple states. Multiple tapes belong to multi-tape Turing machines, and random-access memory belongs to RAM models of computation, not to pushdown automata.

Please log in or register to report this question.

7.

Which of the following is not accepted by Deterministic Push Down Automata (DPDA) but accepted by Non-Deterministic Push Down Automata (NPDA) ?

Exam Year(s)

Tripura Public Service Commission - 2019,

Answer: C

The answer is Even palindromes.

An even palindrome has the form w wR. A pushdown automaton recognises it by pushing the first half and popping to match the second, but nothing in the string marks the middle. A non-deterministic PDA can guess where the middle is; a deterministic one cannot, so the language is accepted by an NPDA but by no DPDA.

Strings ending with a given symbol, and strings in which a given symbol appears at least twice, are regular languages. A finite automaton, and therefore a DPDA, accepts them.

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Pushdown Automata Questions and Answers || Pushdown Automata MCQ Questions and Answers || Pushdown Automata GK Questions and Answers || Pushdown Automata GK MCQ Questions || Pushdown Automata Multiple Choice Questions and Answers || Pushdown Automata GK || GK on Pushdown Automata || Theory of Computation Questions and Answers || Theory of Computation MCQ Questions and Answers || Theory of Computation GK Questions and Answers || GK on Theory of Computation