GATE CS 2026, set 1 · Question 52 · Theory of Computation · Multiple select (MSQ) · 2 marks · no negative marks

Consider the following context-free grammar G.
S → abaABAbbaA → aaBBAb | bBabaaB → aBb | ab
In the above grammar, S is the start symbol, a and b are terminal symbols, and A and B are non-terminal symbols.
Let L(G) be the language generated by the grammar G. For a string s ∈ L(G), let n₁(s) be the number of a's in s and n₂(s) be the number of b's in s.
Which of the following statements is/are true?

  1. (A) There is a string s ∈ L(G) such that n₁(s) < n₂(s)
  2. (B) For every string s ∈ L(G), n₁(s) ≥ n₂(s)
  3. (C) There is a string s ∈ L(G) such that n₁(s) > 2n₂(s)
  4. (D) For every string s ∈ L(G), n₁(s) ≤ 2n₂(s)
Answer

Answer (B), (D)

Answer from the official GATE CS 2026 answer key.

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