MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
The grammar {E
A
Ambiguous
B
Unambiguous
C
Partially ambiguous
D
None of the other options
Explanation: 

Detailed explanation-1: -A grammar can be unambiguous, if the grammar does not contain ambiguity. This means if it does not contain more than one left most derivation (LMD) or more than one right most derivation (RMD) or more than one parse tree for the given input string, it is an unambiguous grammar.

Detailed explanation-2: -According to the given grammar rule, this leftmost derivation is generated for the input string. Since, only one Leftmost derivation is possible for the given string for the given grammar rule, so the grammar is unambiguous.

Detailed explanation-3: -A Grammar that makes more than one Leftmost Derivation (or Rightmost Derivation) for the similar sentence is called Ambiguous Grammar. Example − Verify whether the following Grammar is Ambiguous or Not. For string id + id * id, there exist two parse trees.

Detailed explanation-4: -A grammar can be unambiguous if the grammar does not contain ambiguity that means if it does not contain more than one leftmost derivation or more than one rightmost derivation or more than one parse tree for the given input string.

There is 1 question to complete.