1

The grammar whose productions are → if id then → if id then else → id := id is ambiguous because a) the sentence if a then if b then c:= d has two parse trees b) the left most and right most derivations of the sentence if a then if b then c:= d give rise to different parse trees c) the sentence if a then if b then c:= d else c:= f has more than two parse trees d) the sentence if a then if b then c:= d else c:= f has two parse trees

Correct Answer: d

Make the most of this question

This page focuses on one Theory of Computation and Compiler Design question from Engineering. After checking the answer, return to the topic list to practice more or run a timed set.

Theory of Computation and Compiler Design MCQ: The grammar whose productions are → if id then → if id then else → id := id is ambiguous because a) the sentence if a then if b then c:= d has two parse trees b) the left most and right most derivations of the sentence if a then if b then c:= d give rise to different parse trees c) the sentence if a then if b then c:= d else c:= f has more than two parse trees d) the sentence if a then if b then c:= d else c:= f has two parse trees | Extra Education