GATE | GATE CS 2010 | Question 40

Consider the languages
L1 = {0i1j | i != j}.
L2 = {0i1j | i = j}.
L3 = {0i1j | i = 2j+1}.
L4 = {0i1j | i != 2j}.
(A) Only L2 is context free
(B) Only L2 and L3 are context free
(C) Only L1 and L2 are context free
(D) All are context free

Answer: (D)


All these languages have valid CFGs that can derive them. Hence, all of them are CFLs. Intuitively,
(A) & (B) are well known CFLs and CFGs for (C) & (D) could be made by little modifications in
A & B’s CFGs.




This solution is contributed by vineet purswani.

Quiz of this Question

GATE CS Corner    Company Wise Coding Practice

Recommended Posts:

0 Average Difficulty : 0/5.0
No votes yet.