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)
Explanation:
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.
Quiz of this Question
Please comment below if you find anything wrong in the above post