GATE | GATE-CS-2016 (Set 1) | Question 26

Which of the following languages is generated by the given grammar?

S → aS|bS| ε

(A) \left \{a^{n}b^{m} | n, m \geq  0   \right \}
(B) \left\{  \omega   \varepsilon  \left \{ a, b  \right \}^{*}  | w  \ has \  equal \  number \  of \   a's \  and \ b's \right \}
(C) \left \{ a^{n}| n\geq 0 \right \} U \left \{b^{n}| n\geq 0\right \}U\left \{a^{n}b^{n}\right \} | n\geq 0\right \}
(D) \left \{ a, b  \right \}^{*}
(A) A
(B) B
(C) C
(D) D


Answer: (D)

Explanation: We can draw DFA using given grammar S → aS|bS| ε and generates ε, a, ab, abb, b, aaa, …..

1111

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

Quiz of this Question

My Personal Notes arrow_drop_up