GATE | GATE-CS-2016 (Set 1) | Question 26
Which of the following languages is generated by the given grammar?
S → aS|bS| ε
(A) {anbm | m,n >= 0}
(B) {w∈{a,b}* | w has equal number of a’s and b’s}
(C) {an | n>=0} U {anbn \ n>=0}
(D) {a,b}*
Answer: (D)
Explanation: We can draw DFA using given grammar S → aS|bS| ε and generates ε, a, ab, abb, b, aaa, …..

Therefore, language is {a, b}*.
Option (D) is true.



