Skip to content
GATEiit

GATE CSE 2025 Session 1 Q19: Language generated by S → aaB | Abb

Question

Consider the following context-free grammar GG, where SS, AA, and BB are the variables (non-terminals), aa and bb are the terminal symbols, SS is the start variable, and the rules of GG are described as:

S→aaB∣AbbA→a∣aAB→b∣bB\begin{aligned} S &\to aaB \mid Abb \\ A &\to a \mid aA \\ B &\to b \mid bB \end{aligned}

Which ONE of the languages L(G)L(G) is accepted by GG?

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 1/3 mark in GATE.
Show answer and explanation

Answer: A (official GATE 2025 final answer key)

Concept used: Reading off the language of a simple CFG rule by rule.

First step: AA generates ana^n (n≥1n \ge 1) and BB generates bnb^n (n≥1n \ge 1); substitute them into aaBaaB and AbbAbb.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2025 Session 1 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key