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
GATE CSE 2025 Set 1 · Q44
Time
Select one answerSingle correct
Solution
Official answer: C) L1 is not a regular language but L2 is a regular language.
Regular and Context-Free LanguagesTo determine the regularity of both languages:
Analysis of :
In , , which means for some .
Any string in has the form with and .
Notice that if , we can rewrite , where .
Conversely, any string of the form with can be generated by choosing () and .
Therefore, , which is generated by a regular expression and recognized by a Finite Automaton. Thus, is a regular language.
Analysis of :
In , and .
Intersect with the regular language :
*(since any prefix must match a suffix , the only suffix starting with is , requiring the prefix to be and thus )*.
By the Pumping Lemma, the language is non-regular.
Since regular languages are closed under intersection with regular languages, is not a regular language.
Hence, is not regular and is regular, which corresponds to option (C).
Try the question first, then check your work.
Examiner trap
For , check if setting can generate all valid strings. For , consider intersecting it with the regular language to see if an infinite comparison (like ) is required.
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
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.
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 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 LanguagesIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.