Skip to content
Related Articles
Open in App
Not now

Related Articles

UGC-NET | UGC NET CS 2017 Jan – III | Question 23

Improve Article
Save Article
  • Last Updated : 13 May, 2020
Improve Article
Save Article

Given the following two languages :
L1 = {an bn | n ≥ 0, n ≠ 100}
L2 = {w ∈ {a, b, c}*| na(w) = nb(w) = nc(w)}
Which of the following options is correct ?
(A) Both L1 and L2 are not context free language
(B) Both L1 and L2 are context free language.
(C) L1 is context free language, L2 is not context free language.
(D) L1 is not context free language, L2 is context free language.


Answer: (C)

Explanation: Language L1 = {an bn | n ≥ 0, n ≠ 100} is context free because we push all the a^n into the stack and pop all b^n element for each a^n element since we can compare all a’s and b’s here using only one stack.

But language L2 = {w ∈ {a, b, c}*| na(w) = nb(w) = nc(w)} is not context free language because we can not compare all a’s, b’s and c’s simultaneously with the help of only one stack for this we need more then one stack here then this language L2 becomes context sensitive language.

Option (C) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!