Skip to content
Mad4Study

Engineering & Science

GATE Computer Science

  • GATE CS
  • 2026–27 pattern practice
  • Theory of Computation
  • Context-free grammars
  • Medium

Context-free languages are NOT closed under which operation?

Context-Free Languages

Pick an option to check your answer.

L1={anbncm}L_1 = \{a^n b^n c^m\} and L2={ambncn}L_2 = \{a^m b^n c^n\} are both context-free. Their intersection is {anbncn}\{a^n b^n c^n\}, which is not context-free. So CFLs are not closed under intersection. (They are closed under intersection with a regular language.)

Why not the others

  • Union is closed: add S→S1∣S2S \to S_1 \mid S_2.
  • Concatenation is closed: add S→S1S2S \to S_1 S_2.
  • Kleene star is closed: add S→SS1∣εS \to S S_1 \mid \varepsilon.

Report an error

GATE CS · Theory of Computation · Context-Free Languages