Consider the language L = {anbn-3 | n>2} on Σ = {a, b}. Which one of the following grammars generates the language L?
(A)
S → aaaA | λ, A → aAb | λ
(B)
S → aaA | λ, A → aAb | λ
(C)
S → aaaA | a, A → aAb | λ
(D)
S → aA | a, A → aAb | b
Answer: (D)
Explanation:
For n=3, String generated= aaa
For n= 4, String generated = aaaab
For n =5, String generated = aaaaabb
Only, option 4 can generate the above grammar at following values of n.
Quiz of this Question
Please comment below if you find anything wrong in the above post
Article Tags :
Uncategorized
Recommended Articles