GateAI
Regular and Context-Free Languages

GATE CSE 2014 Set 3 · Q36

MCQ2 marksMedium

Time

Consider the following languages over the alphabet Σ={0,1,c}\Sigma = \{0, 1, c\}: L1={0n1n∣n≥0}L2={wcwr∣w∈{0,1}∗}L3={wwr∣w∈{0,1}∗} \begin{aligned} L_1 &= \{0^n 1^n \mid n \ge 0\} L_2 &= \{w c w^r \mid w \in \{0, 1\}^*\} L_3 &= \{w w^r \mid w \in \{0, 1\}^*\} \end{aligned} Here, wrw^r is the reverse of the string ww. Which of these languages are deterministic Context-free languages?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: C) Only L1 and L2

Regular and Context-Free Languages

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

  1. L1={0n1n∣n≥0}L_1 = \{0^n 1^n \mid n \ge 0\}: A DPDA can push all 0's onto the stack and then pop a 0 for each 1 seen. Since there is no ambiguity about where the 0s end and 1s begin, L1L_1 is a DCFL.

  2. **L2={wcwr∣w∈{0,1}∗}L_2 = \{w c w^r \mid w \in \{0, 1\}^*\}: The marker symbol cc clearly indicates the midpoint of the string. The DPDA can push symbols of ww onto the stack, transition deterministically upon reading cc, and then compare subsequent symbols with the stack to match wrw^r. Thus, L2L_2 is a DCFL**.

  3. **L3={wwr∣w∈{0,1}∗}L_3 = \{w w^r \mid w \in \{0, 1\}^*\}: L3L_3 consists of even-length palindromes without a middle marker. A pushdown automaton cannot deterministically guess where ww ends and wrw^r begins; it requires non-deterministic guessing. Thus, L3L_3 is a non-deterministic CFL and not** a DCFL.

Therefore, only L1L_1 and L2L_2 are deterministic context-free languages, which corresponds to option (C).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Regular and Context-Free Languages previous year question is Q36 of the GATE CSE 2014 Set 3 paper. Find more GATE CSE PYQs on Regular and Context-Free Languages in Theory of Computation, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Regular and Context-Free Languages PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Regular and Context-Free Languages in GATE CSE

Regular and Context-Free Languages has 21 GATE CSE PYQs across 13 papers from 2011 to 2026. 9 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2014 Set 3.

How GATE tests Regular and Context-Free Languages

More from GATE CSE 2014 Set 3

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2014 Set 3 · Q36 · MCQ

Consider the following languages over the alphabet = {0, 1, c}: L1 &= {0n 1n n ≥ 0} L2 &= {w c wr w ∈ {0, 1}*} L3 &= {w wr w ∈ {0, 1}*} Here, wr is the reverse of the string w. Which of these languages are deterministic Context-free languages?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.