GATE CS 2023 · Question 39 · Theory of Computation · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer

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
Answer

Answer (B)

Answer from the official GATE CS 2023 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes