IAE Academy

GATE 2025 CS2 Q.24: solution and answer

GATE 2025 · CS2Q.24 · 1 mark · MCQ

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

  1. (A)

    Any regular language.

  2. (B)

    Any context-free language.

  3. (C)

    Any language accepted by a non-deterministic pushdown automaton.

  4. (D)

    Any decidable language.

See the question in the paper

Answer and solution

ANSWER

Every regular language is accepted by a deterministic pushdown automaton, so the answer is (A).

Official answer: ASource: Official answer key, GATE 2025 CS2 (IIT Roorkee)

  1. A deterministic pushdown automaton (DPDA) accepts exactly the deterministic context-free languages (DCFLs). The question asks which option holds for every language in the class it names, so we test each class against the DCFLs.

  2. (A) Any DFA is a DPDA that never touches its stack, so every regular language is accepted by a DPDA. This option is true for any regular language.

  3. (B) The language is context-free, but a machine must guess where the middle of the input is, and a DPDA cannot do that. No DPDA accepts it, so not every context-free language is accepted by a DPDA.

  4. (C) A language accepted by a non-deterministic pushdown automaton is exactly a context-free language. The same language is accepted by an NPDA but by no DPDA, so (C) fails.

  5. (D) The language is decidable but not context-free. No PDA of either kind accepts it, so a decidable language need not be accepted by a DPDA, and (D) fails.

  6. The classes nest as regular DCFL CFL decidable. Only the regular languages are all inside the DCFLs, so the answer is (A).

KEY IDEA

The languages a DPDA accepts (DCFLs) lie strictly between the regular languages and the context-free languages. Only the regular languages are guaranteed to be inside the DCFLs.

WATCH OUT FOR

Assuming a DPDA is as powerful as an NPDA, and picking (B) or (C). Languages like need a guess of the midpoint, which only a non-deterministic machine can make.

From the GATE 2025 CS2 paper. Every question of this paper · Download the full paper · All 9 CFG & PDA questions, with notes

More CFG & PDA questions