MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

THEORY OF COMPUTATION

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
If L1 and L2 are context free language and R a regular set, then which one of the languages below is not necessarily a context free language?
A
L1 L2
B
L1 ∩ L2
C
L1 ∩ R
D
L1 ∪ L2
Explanation: 

Detailed explanation-1: -(d) If L1 and L2 are context free languages then L1∪L2 is surely context free language because context free languages are closed under union.

Detailed explanation-2: -Context-free languages are not closed under complementation. L1 and L2 are CFL.

Detailed explanation-3: -We can prove that a language is context-free if we construct a context-free grammar that generates it. Alternatively, we can create a pushdown automaton that recognizes the language. On the other hand, we use Ogden’s lemma and the pumping lemma for context-free languages to prove that a language isn’t context-free.

Detailed explanation-4: -The correct answer is option 1. Concept: Option 1: The union of two context-free languages is context-free.

There is 1 question to complete.