Question:

Suppose that \(L_1\) is a regular language and \(L_2\) is a context-free language. Which one of the following languages is NOT necessarily context-free?

Show Hint

Always remember key closure properties: CFLs are not closed under complementation or general set difference.
Updated On: Jan 2, 2026
  • \(L_1 \cap L_2\)
  • \(L_1 \cdot L_2\)
  • \(L_1 - L_2\)
  • \(L_1 \cup L_2\)
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Step 1: Recall closure properties.
Context-free languages are closed under union and concatenation. They are also closed under intersection with regular languages.

Step 2: Analyze each option.
\(L_1 \cap L_2\) is context-free because CFLs are closed under intersection with regular languages.
\(L_1 \cdot L_2\) is context-free because CFLs are closed under concatenation.
\(L_1 \cup L_2\) is context-free due to closure under union.

Step 3: Examine set difference.
The language \(L_1 - L_2 = L_1 \cap \overline{L_2}\). Context-free languages are not closed under complementation. Hence, this operation does not guarantee a context-free language.

Step 4: Conclusion.
Therefore, \(L_1 - L_2\) is NOT necessarily context-free.

Final Answer: (C)

Was this answer helpful?
0
0

Questions Asked in GATE CS exam

View More Questions