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

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.