Skip to content
Official PYQ · 1996

GATE CS 1996 Q2.8 — Context-free Grammars and Push-down Automata

Explain with AI

If L1L_1 and L2L_2 are context free languages and RR a regular set, one of the languages below is not necessarily a context free language. Which one?

Choose one option
View worked solution

Answer: B

Context-free languages (CFLs) have specific closure properties:

  • Union (L1∪L2L_1 \cup L_2): Closed. If L1L_1 and L2L_2 are CFLs, their union is also a CFL.
  • Concatenation (L1⋅L2L_1 \cdot L_2): Closed. If L1L_1 and L2L_2 are CFLs, their concatenation is also a CFL.
  • Intersection with a regular language (L1∩RL_1 \cap R): Closed. The intersection of a CFL and a regular language is always a CFL.
  • Intersection (L1∩L2L_1 \cap L_2): Not closed. The intersection of two CFLs is not necessarily a CFL.

For example, the languages L1={anbncm∣n,m≥0}L_1 = \{a^n b^n c^m \mid n, m \ge 0\} and L2={ambncn∣n,m≥0}L_2 = \{a^m b^n c^n \mid n, m \ge 0\} are both context-free, but their intersection L1∩L2={anbncn∣n≥0}L_1 \cap L_2 = \{a^n b^n c^n \mid n \ge 0\} is a well-known non-context-free language.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Context-free Grammars and Push-down Automata questions