# UGC-NET | UGC NET CS 2015 Dec – III | Question 28

Given the following two languages:
L1 = {anban|n > 0}
L2 = {an b an bn + 1|n > 0}
Which of the following is correct ?
(A) L1 is context free language and L2 is not context free language
(B) L1 is not context free language and L2 is context free language
(C) Both L1 and L2 are context free languages
(D) Both L1 and L2 are not context free languages

Explanation: Language L1 is context free language as L1 = {anban|n > 0}, we can compare number of a’s before b and number of a’s after b both are equal using only one stack using push and pop function but we can not compare language L2.

L2 = {an b an bn + 1|n > 0} using only one stack here we can compare all number of a’s before b and number of a’s after b both are equal using only one stack using push and pop function but we cannot compare all bn + 1 at that time.

Hence, L1 is context free language and L2 is not context free language.

Quiz of this Question

My Personal Notes arrow_drop_up

Improved By : ApurvaRaj

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.