GATE CS 2025, set 1 · Question 19 · Theory of Computation · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer
Consider the following context-free grammar G, where S, A, and B are the variables (non-terminals), a and b are the terminal symbols, S is the start variable, and the rules of G are described as:
S → aaB | Abb ; A → a | aA ; B → b | bB
Which ONE of the languages L(G) is accepted by G?
- (A) L(G) = {a²bⁿ | n ≥ 1} ∪ {aⁿb² | n ≥ 1}
- (B) L(G) = {aⁿb²ⁿ | n ≥ 1} ∪ {a²ⁿbⁿ | n ≥ 1}
- (C) L(G) = {aⁿbⁿ | n ≥ 1}
- (D) L(G) = {a²ⁿb²ⁿ | n ≥ 1}
Answer
Answer (A)
Answer from the official GATE CS 2025 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes