IAE Academy

ISRO CS 2025 Q.80: solution and answer

ISRO 2025 · CSQ.80 · 1 mark · MCQ

Consider the context-free grammar G below. Here S is the starting non-terminal symbol, while a and b are terminal symbols.
S → a S b | T
T → b T | b
The language generated by G is:

  1. (A)

    {a^m b^n : 0 ≤ m < n}

  2. (B)

    {a^m b^n : 0 < m < n}

  3. (C)

    {a^m b^n : 0 < n ≤ m}

  4. (D)

    {a^n b^n : 0 ≤ n}

See the question in the paper

Answer and solution

ANSWER

The grammar generates , which is option (a).

Official answer: ASource: ISRO's final answer key of 15 May 2026

  1. Start with . The rules give for every , so always produces at least one and nothing else.

  2. The rule puts one on the left and one on the right of . Applying it times gives .

  3. Finish with and then . This gives with and . These are the only ways to derive a terminal string, since is the only exit from .

  4. Put . Then , so . Conversely, any pair with is generated by taking . Hence .

  5. Option (b) requires , but generates (with ). Option (c) requires , but every generated string has . Option (d) requires , but forces at least one extra . So the answer is (a).

KEY IDEA

Each use of adds one and one matching , while contributes at least one unmatched at the end, so the number of 's always exceeds the number of 's.

WATCH OUT FOR

Forgetting that can be used immediately (with ), and so wrongly requiring , which gives option (b).

From the ISRO CS 2025 paper. Every question of this paper · The full paper (PDF, ISRO) · All 6 ISRO CFG & PDA questions, with notes

More ISRO CFG & PDA questions