GateAI
Context-Free Grammars and PDAs

GATE CSE 2016 Set 2 · Q17

MCQ1 markEasy

Time

Language L1L_1 is defined by the grammar: S1→aS1b∣εS_1 \to aS_1b \mid \varepsilon Language L2L_2 is defined by the grammar: S2→abS2∣εS_2 \to abS_2 \mid \varepsilon Consider the following statements: PP: L1L_1 is regular QQ: L2L_2 is regular Which one of the following is TRUE\textbf{TRUE}?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: C) P is false and Q is true

Context-Free Grammars and PDAs
  1. Language L1L_1: The production S1→aS1b∣εS_1 \to aS_1b \mid \varepsilon generates the language:

    L1={anbn∣n≥0}L_1 = \{a^n b^n \mid n \ge 0\}

    L1L_1 is a standard non-regular context-free language (it requires a stack to match the number of aa's and bb's). Therefore, statement PP is false.

  2. Language L2L_2: The production S2→abS2∣εS_2 \to abS_2 \mid \varepsilon is a right-linear grammar that generates:

    L2={(ab)n∣n≥0}=(ab)∗L_2 = \{(ab)^n \mid n \ge 0\} = (ab)^*

    Since L2L_2 can be expressed by a regular expression (ab)∗(ab)^*, it is regular. Therefore, statement QQ is true.

Hence, PP is false and QQ is true, making (C) the correct option.

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 Q17 of the GATE CSE 2016 Set 2 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. 9 of them are 1-mark MCQs like this one, and GATE CSE 2016 Set 2 has 2.

How GATE tests Context-Free Grammars and PDAs

More from GATE CSE 2016 Set 2

Share this solution

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

GateAI solution cardGATE CSE 2016 Set 2 · Q17 · MCQ

Language L1 is defined by the grammar: S1 → aS1b Language L2 is defined by the grammar: S2 → abS2 Consider the following statements: P: L1 is regular Q: L2 is regular Which one of the following is 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.