Consider the following context-free grammar \(G\), where \(𝑆, 𝐴,\) and \(B\)…

GATE · 2025 · CS · Set 1 · Computer Science & IT

Consider the following context-free grammar GG, where 𝑆,𝐴,𝑆, 𝐴, 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:

𝑆→𝑎𝑎𝐵∣𝐴𝑏𝑏𝐴→𝑎∣𝑎𝐴𝐵→𝑏∣𝑏B𝑆 → 𝑎𝑎𝐵 | 𝐴𝑏𝑏 \\ \\𝐴 → 𝑎 | 𝑎𝐴 \\ \\𝐵 → 𝑏 | 𝑏B \\

Which ONE of the languages 𝐿(𝐺)𝐿(𝐺) is accepted by GG?

  1. A.

    L(G)={a2bn∣n≥1}∪{anb2∣n≥1}L(G) = \{ a^{2} b^n \mid n \geq 1 \} \cup \{ a^n b^2 \mid n \geq 1 \}

  2. B.

    L(G)={anb2n∣n≥1}∪{a2nbn∣n≥1}L(G) = \{ a^n b^{2n} \mid n \geq 1 \} \cup \{ a^{2n} b^n \mid n \geq 1 \}

  3. C.

    L(G)={anbn∣n≥1}L(G) = \{ a^n b^n \mid n \geq 1 \}

  4. D.

    L(G)={a2nb2n∣n≥1}L(G) = \{ a^{2n} b^{2n} \mid n \geq 1 \}

Attempted by 139 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…