GateAI
Regular and Context-Free Languages

GATE CSE 2025 Set 1 · Q44

MCQ2 marksMedium

Time

Consider the following two languages over the alphabet {a,b} \{a, b\} : L1={αβα∣α∈{a,b}+ AND β∈{a,b}+} L_1 = \{ \alpha\beta\alpha \mid \alpha \in \{a, b\}^+ \text{ AND } \beta \in \{a, b\}^+ \} L2={αβα∣α∈{a}+ AND β∈{a,b}+} L_2 = \{ \alpha\beta\alpha \mid \alpha \in \{a\}^+ \text{ AND } \beta \in \{a, b\}^+ \} Which ONE of the following statements is CORRECT?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: C) L1 is not a regular language but L2 is a regular language.

Regular and Context-Free Languages

To determine the regularity of both languages:

  1. Analysis of L2L_2:

    • In L2L_2, α∈{a}+\alpha \in \{a\}^+, which means α=ak\alpha = a^k for some k≥1k \ge 1.

    • Any string in L2L_2 has the form w=akβakw = a^k \beta a^k with k≥1k \ge 1 and β∈{a,b}+\beta \in \{a, b\}^+.

    • Notice that if k>1k > 1, we can rewrite w=a(ak−1βak−1)a=aβ′aw = a(a^{k-1}\beta a^{k-1})a = a\beta^{\prime} a, where β′=ak−1βak−1∈{a,b}+\beta^{\prime} = a^{k-1}\beta a^{k-1} \in \{a, b\}^+.

    • Conversely, any string of the form aβ′aa \beta^{\prime} a with β′∈{a,b}+\beta^{\prime} \in \{a, b\}^+ can be generated by choosing α=a\alpha = a (k=1k = 1) and β=β′\beta = \beta^{\prime}.

    • Therefore, L2=a(a+b)+aL_2 = a(a + b)^+a, which is generated by a regular expression and recognized by a Finite Automaton. Thus, L2L_2 is a regular language.

  2. Analysis of L1L_1:

    • In L1L_1, α∈{a,b}+\alpha \in \{a, b\}^+ and β∈{a,b}+\beta \in \{a, b\}^+.

    • Intersect L1L_1 with the regular language R=ab+ab+R = a b^+ a b^+:

      L1∩R={abmabn∣m>n≥1}L_1 \cap R = \{ a b^m a b^n \mid m > n \ge 1 \}

      *(since any prefix α\alpha must match a suffix α\alpha, the only suffix starting with aa is abna b^n, requiring the prefix to be abna b^n and thus m=n+∣β∣>nm = n + |\beta| > n)*.

    • By the Pumping Lemma, the language {abmabn∣m>n≥1}\{ a b^m a b^n \mid m > n \ge 1 \} is non-regular.

    • Since regular languages are closed under intersection with regular languages, L1L_1 is not a regular language.

Hence, L1L_1 is not regular and L2L_2 is regular, 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 Q44 of the GATE CSE 2025 Set 1 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 2025 Set 1 has 2.

How GATE tests Regular and Context-Free Languages

More from GATE CSE 2025 Set 1

Share this solution

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

GateAI solution cardGATE CSE 2025 Set 1 · Q44 · MCQ

Consider the following two languages over the alphabet {a, b} : L1 = { ∈ {a, b}+ AND ∈ {a, b}+ } L2 = { ∈ {a}+ AND ∈ {a, b}+ } Which ONE of the following statements is CORRECT?

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.