Let L1 be a regular language and L2 be a context-free language. Which of the following languages is/are context-free?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2021 Set 2 · Q12
Time
Select all that applyOne or more correct
Solution
Official answer: B) L1 ∪ L2; C) L1 ∪ (L2 ∪ L2); D) (L1 ∩ L2) ∪ ( L1 ∩ L2)
Regular and Context-Free LanguagesLet us analyze each option using set theory and closure properties of context-free languages (CFLs):
Option (A): CFLs are not closed under complementation, so may not be a CFL or even recursive. Thus, the intersection of a regular language and the complement of a CFL is not necessarily context-free.
Option (B): By De Morgan's laws:
The intersection of a regular language () and a context-free language () is always context-free. Thus, (B) is a CFL.
Option (C): Since :
is a regular language, and every regular language is also context-free. Thus, (C) is a CFL.
Option (D): By distributive law of set theory:
Since is context-free, this language is context-free. Thus, (D) is a CFL.
Therefore, options B, C, and D are correct.
Try the question first, then check your work.
Examiner trap
Apply De Morgan's laws and set identities to simplify expressions involving unions and intersections with language complements.
This Regular and Context-Free Languages previous year question is Q12 of the GATE CSE 2021 Set 2 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. 3 of them are 1-mark MSQs like this one, and GATE CSE 2021 Set 2 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.