GateAI
Regular and Context-Free Languages

GATE CSE 2011 · Q26

MCQ2 marksEasy

Time

Consider the languages L1L1, L2L2 and L3L3 as given below. L1={0p1q∣p,q∈N}L1 = \{0^p 1^q \mid p, q \in \mathbb{N}\}, L2={0p1q∣p,q∈N and p=q}L2 = \{0^p 1^q \mid p, q \in \mathbb{N} \text{ and } p = q\} and L3={0p1q0r∣p,q,r∈N and p=q=r}L3 = \{0^p 1^q 0^r \mid p, q, r \in \mathbb{N} \text{ and } p = q = r\}. Which of the following statements is NOT TRUE?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: C) All the three languages are context free

Regular and Context-Free Languages

Let us analyze the three languages:

  1. L1={0p1q∣p,q∈N}L1 = \{0^p 1^q \mid p, q \in \mathbb{N}\} represents the regular language given by the regular expression 0∗1∗0^*1^*. Since every regular language is also context-free, L1L1 is regular and can be recognized by a finite automaton as well as a pushdown automaton (PDA).

  2. L2={0p1q∣p,q∈N and p=q}={0n1n∣n∈N}L2 = \{0^p 1^q \mid p, q \in \mathbb{N} \text{ and } p = q\} = \{0^n 1^n \mid n \in \mathbb{N}\} requires matching the number of 00s with the number of 11s. It is a deterministic context-free language (DCFL) and can be recognized by a PDA.

  3. L3={0p1q0r∣p,q,r∈N and p=q=r}={0n1n0n∣n∈N}L3 = \{0^p 1^q 0^r \mid p, q, r \in \mathbb{N} \text{ and } p = q = r\} = \{0^n 1^n 0^n \mid n \in \mathbb{N}\} requires comparing three independent counts simultaneously, which cannot be done with a single stack. By the pumping lemma for context-free languages, L3L3 is not context-free (it is context-sensitive / recursively enumerable).

  4. Turing machines can recognize all recursively enumerable languages, which includes L1L1, L2L2, and L3L3.

Therefore, statement (C) ("All the three languages are context free") is NOT TRUE.

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 Q26 of the GATE CSE 2011 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 GATE CSE 2011 has 2.

How GATE tests Regular and Context-Free Languages

More from GATE CSE 2011

Share this solution

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

GateAI solution cardGATE CSE 2011 · Q26 · MCQ

Consider the languages L1, L2 and L3 as given below. L1 = {0p 1q p, q ∈ N}, L2 = {0p 1q p, q ∈ N and p = q} and L3 = {0p 1q 0r p, q, r ∈ N and p = q = r}. Which of the following statements is NOT TRUE?

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.