Skip to content
Official PYQ · 2005

GATE CS 2005 Q57 — Context-free Grammars and Push-down Automata

Explain with AI

Consider the languages:

  • L1={wwR∣w∈{0,1}∗}L_1 = \left\{ww^R \mid w \in \{0, 1\}^* \right\}
  • L2={w#wR∣w∈{0,1}∗}L_2 = \left\{w\text{\#}w^R \mid w \in \{0, 1\}^* \right\}, where #\text{\#} is a special symbol
  • L3={ww∣w∈{0,1}∗}L_3 = \left\{ww \mid w \in \{0, 1\}^* \right\}

Which one of the following is TRUE?

Choose one option
View worked solution

Answer: B

Let's analyze each language individually:

  • L1={wwR∣w∈{0,1}∗}L_1 = \{ww^R \mid w \in \{0, 1\}^*\}: This is the language of even-length palindromes. Because there is no marker to indicate the boundary between ww and wRw^R, a pushdown automaton (PDA) must non-deterministically guess the midpoint to start popping from the stack. Therefore, L1L_1 is a Context-Free Language (CFL) but not a Deterministic CFL (DCFL).
  • L2={w#wR∣w∈{0,1}∗}L_2 = \{w\#w^R \mid w \in \{0, 1\}^*\}: The presence of the special marker #\# clearly separates ww from wRw^R. A Deterministic PDA (DPDA) can push the symbols of ww onto the stack, transition on reading #\# without changing the stack, and then match the remaining input with the popped symbols of the stack. Since it can be recognized by a DPDA, L2L_2 is a Deterministic CFL (DCFL).
  • L3={ww∣w∈{0,1}∗}L_3 = \{ww \mid w \in \{0, 1\}^*\}: This is the copy language. To recognize L3L_3, we need to match the first half of the string with the second half in the exact same order (FIFO). Since a PDA uses a LIFO stack, it cannot recognize this language. Using the pumping lemma, it can be proven that L3L_3 is not a CFL at all.

Comparing these findings with the options:

  • Option A is false because L1L_1 is non-deterministic.
  • Option B is true because L2L_2 is a DCFL.
  • Options C and D are false because L3L_3 is not a CFL.

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

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