Which of the following languages is generated by the given grammar? S → aS |…

GATE · 2016 · CS · Set 1 · Computer Science & IT

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

S → aS | bS | ε

  1. A.

    {an bm | n,m ≥ 0}

  2. B.

    {w ∈ {a,b}∗ | w has equal number of a’s and b’s }

  3. C.

    {an | n ≥ 0} ∪ {bn | n ≥ 0} ∪ {an bn | n ≥ 0}

  4. D.

    {a,b}* 

Attempted by 233 students.

Show answer

Correct answer: D

The worked solution is available to enrolled students.

Video solution available to enrolled students.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…