Consider the context-free grammar G below S → aSb | X X → aX | Xb | a | b ,…

GATE · 2023 · CS · Computer Science & IT

Consider the context-free grammar G below

        S → aSb | X
        X → aX | Xb | a | b ,

where S and X are non-terminals, and a and b are terminal symbols. The starting non-terminal is S.
Which one of the following statements is CORRECT?

  1. A.

    The language generated by G is (a + b)∗

  2. B.

    The language generated by G is a∗(a + b)b∗

  3. C.

    The language generated by G is a∗b∗(a + b)

  4. D.

    The language generated by G is not a regular language

Attempted by 116 students.

Show answer

Correct answer: B

The worked solution is available to enrolled students.

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

Loading lesson…