Skip to content
Official PYQ · 1997

GATE CS 1997 Q6.6 — Context-free Grammars and Push-down Automata

Explain with AI

Which of the following languages over {a,b,c}\left\{a,b,c\right\} is accepted by a deterministic pushdown automata?


Note: wRw^R is the string obtained by reversing ′w′'w'.

Choose one option
View worked solution

Answer: A

A language is accepted by a Deterministic Pushdown Automaton (DPDA) if and only if it is a Deterministic Context-Free Language (DCFL).

  • Option A: {wcwR∣w∈{a,b}∗}\{ wcw^R \mid w \in \{a,b\}^*\}
    The symbol cc acts as a clear, unique marker separating ww and wRw^R. The DPDA can push symbols of ww onto the stack, and upon reading cc, deterministically switch to popping and matching the remaining input against the stack. Thus, it is a DCFL and accepted by a DPDA.
  • Option B: {wwR∣w∈{a,b,c}∗}\{ ww^R \mid w \in \{a,b,c\}^*\}
    There is no middle marker. A PDA must non-deterministically guess the midpoint where ww ends and wRw^R begins. Hence, it is not a DCFL.
  • Option C: {anbncn∣n≥0}\{ a^nb^nc^n \mid n \geq 0 \}
    This is a well-known non-context-free language (CSL) and cannot be accepted by any PDA.
  • Option D: Palindromes over {a,b,c}\{a,b,c\}
    This includes even-length palindromes (wwRww^R) and odd-length palindromes (wawR,wbwR,wcwRwaw^R, wbw^R, wcw^R). Without a designated marker to identify the exact midpoint, it requires non-deterministic guessing and is not a DCFL.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Context-free Grammars and Push-down Automata questions