Consider the following grammar where 𝑆 is the start symbol, and π‘Ž and 𝑏 are…

2026

Consider the following grammar where 𝑆 is the start symbol, and π‘Ž and 𝑏 are terminal symbols.

π‘†β†’π‘Žπ‘†π‘π‘† ∣ 𝑏𝑆 ∣ Ο΅

Which of the following statements is/are true?

  1. A.

    The grammar is ambiguous

  2. B.

    The string π‘Žπ‘π‘ has two distinct derivations in this grammar

  3. C.

    The string π‘Žπ‘π‘Žπ‘ has only one rightmost derivation

  4. D.

    The language generated by the grammar is undecidable

Attempted by 17 students.

Show answer & explanation

Correct answer: A, B, C

The grammar S β†’ aSbS | bS | Ξ΅ generates a Context-Free Language. To check for ambiguity, consider the string 'abb'. It admits two distinct derivations: S β‡’ aSbS β‡’ abS bS β‡’ abb and another structural variation, confirming the grammar is ambiguous (Options 0 and 1). For string 'abab', the derivation structure forces a unique rightmost path, validating Option 2. Since all Context-Free Languages are decidable, the claim regarding undecidability is false.

Explore the full course: Gate Guidance By Sanchit Sir