Consider the following context-free grammar 𝐺. π‘†β†’π‘Žπ‘π‘Žπ΄π΅π΄π‘π‘π‘Žβ€¦

2026

Consider the following context-free grammar 𝐺.

π‘†β†’π‘Žπ‘π‘Žπ΄π΅π΄π‘π‘π‘Ž

π΄β†’π‘Žπ‘Žπ΅π΅π΄π‘ | π‘π΅π‘Žπ‘π‘Žπ‘Ž

π΅β†’π‘Žπ΅π‘ | π‘Žπ‘

In the above grammar, 𝑆 is the start symbol, π‘Ž and 𝑏 are terminal symbols, and 𝐴 and B are non-terminal symbols.

Let 𝐿(𝐺) be the language generated by the grammar 𝐺. For a string π‘ βˆˆπΏ(𝐺), let n1(𝑠) be the number of π‘Žβ€™s in 𝑠 and 𝑛2(𝑠) be the number of 𝑏’s in 𝑠.

Which of the following statements is/are true?

Answer: B. For every string π‘ βˆˆπΏ(𝐺), 𝑛1(𝑠)β‰₯𝑛2(𝑠); D. For every string π‘ βˆˆπΏ(𝐺), 𝑛1(𝑠)≀2𝑛2(𝑠)

  1. A.

    There is a string π‘ βˆˆπΏ(𝐺) such that 𝑛1(𝑠)<𝑛2(𝑠)

  2. B.

    For every string π‘ βˆˆπΏ(𝐺), 𝑛1(𝑠)β‰₯𝑛2(𝑠)

  3. C.

    There is a string π‘ βˆˆπΏ(𝐺) such that 𝑛1(𝑠)>2𝑛2(𝑠)

  4. D.

    For every string π‘ βˆˆπΏ(𝐺), 𝑛1(𝑠)≀2𝑛2(𝑠)

Attempted by 26 students.

Show answer & explanation

Correct answer: B, D

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…