Consider the grammar G with start symbol A and production: A → A # A | 1 Which…

Consider the grammar G with start symbol A and production:

A → A # A | 1

Which of the following options is not correct?

Answer: C. Every string generated by the grammar has more than one parse treeCorrect answer: Every string generated by the grammar has more than one parse tree. The statement is not correct because some generated strings have a unique…

  1. A.

    The string "1#1" has one parse tree / leftmost derivation

  2. B.

    The string "1#1#1" has two parse trees / leftmost derivations

  3. C.

    Every string generated by the grammar has more than one parse tree

  4. D.

    Grammar G is ambiguous

Attempted by 66 students.

Show answer & explanation

Correct answer: C

Correct answer: Every string generated by the grammar has more than one parse tree.

The statement is not correct because some generated strings have a unique parse tree. For example, "1" and "1#1" each have only one parse tree.

However, the grammar is still ambiguous. The string "1#1#1" can be parsed in two ways:
1. (1#1)#1
2. 1#(1#1)

So option 4 is true, option 2 is true, and option 1 is true. The only incorrect statement is option 3.

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…