GateAI
Context-Free Grammars and PDAs

GATE CSE 2022 · Q48

MSQ2 marksMedium

Time

Consider the following languages: L1={ww∣w∈{a,b}∗}L_1 = \{ww \mid w \in \{a,b\}^*\} L2={anbncm∣m,n≥0}L_2 = \{a^n b^n c^m \mid m, n \ge 0\} L3={ambncn∣m,n≥0}L_3 = \{a^m b^n c^n \mid m, n \ge 0\} Which of the following statements is/are FALSE?

Select all that applyOne or more correct

Pick every correct option

Solution

Step-by-step verified solution

Official answer: B) Neither L1 nor L2 is context-free.; C) L2, L3 and L2 ∩ L3 all are context-free.; D) Neither L1 nor its complement is context-free.

Context-Free Grammars and PDAs

Let us analyze each language and statement:

  1. Language properties:

    • L1={ww∣w∈{a,b}∗}L_1 = \{ww \mid w \in \{a,b\}^*\} is a well-known non-context-free language (provable by the Pumping Lemma for CFLs). However, its complement L1‾\overline{L_1} is context-free because any string not in L1L_1 is either of odd length, or of even length 2k2k where there exists some position ii (1≤i≤k1 \le i \le k) such that the ii-th symbol differs from the (k+i)(k+i)-th symbol.

    • L2={anbncm∣m,n≥0}L_2 = \{a^n b^n c^m \mid m, n \ge 0\} is a Deterministic Context-Free Language (DCFL) because a DPDA can push all aa's, match and pop with bb's, and then consume cc's.

    • L3={ambncn∣m,n≥0}L_3 = \{a^m b^n c^n \mid m, n \ge 0\} is also a DCFL.

    • L2∩L3={anbncn∣n≥0}L_2 \cap L_3 = \{a^n b^n c^n \mid n \ge 0\}, which is well known to be non-context-free.

  2. Evaluating the options:

    • Statement (A): "L1L_1 is not context-free but L2L_2 and L3L_3 are deterministic context-free." — This statement is TRUE.

    • Statement (B): "Neither L1L_1 nor L2L_2 is context-free." — This statement is FALSE because L2L_2 is context-free.

    • Statement (C): "L2L_2, L3L_3 and L2∩L3L_2 \cap L_3 all are context-free." — This statement is FALSE because L2∩L3L_2 \cap L_3 is not context-free.

    • Statement (D): "Neither L1L_1 nor its complement is context-free." — This statement is FALSE because the complement of L1L_1 is context-free.

Since the question asks which statements are FALSE, the correct choices are B, C, and D.

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 Context-Free Grammars and PDAs previous year question is Q48 of the GATE CSE 2022 paper. Find more GATE CSE PYQs on Context-Free Grammars and PDAs 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 Context-Free Grammars and PDAs 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.

Context-Free Grammars and PDAs in GATE CSE

Context-Free Grammars and PDAs has 26 GATE CSE PYQs across 17 papers from 2011 to 2026. 4 of them are 2-mark MSQs like this one, and it is the only one in GATE CSE 2022.

How GATE tests Context-Free Grammars and PDAs

More from GATE CSE 2022

Share this solution

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

GateAI solution cardGATE CSE 2022 · Q48 · MSQ

Consider the following languages: L1 = {ww w ∈ {a,b}*} L2 = {an bn cm m, n ≥ 0} L3 = {am bn cn m, n ≥ 0} Which of the following statements is/are FALSE?

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.