MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
When there is a reduce/reduce conflict?
A
If a state does not know whether it will make a shift operation using the production rule i or j for a terminal
B
If a state does not know whether it will make a shift or reduction operation using the production rule i or j for a terminal
C
If a state does not know whether it will make a reduction operation using the production rule i or j for a terminal
D
None of the mentioned
Explanation: 

Detailed explanation-1: -When there is a reduce/reduce conflict? Explanation: It occurs when If a state does not know whether it will make a reduction operation using the production rule i or j for a terminal. Explanation: There is no terminal before the non terminal beta.

Detailed explanation-2: -In shift-reduce parsing, there is two types of conflicts: one is shift-reduce conflict (SR conflict) and another is reduce – reduce conflict (RR) conflict.

Detailed explanation-3: -A reduce/reduce conflict occurs if there are two or more rules that apply to the same sequence of input. This usually indicates a serious error in the grammar. For example, here is an erroneous attempt to define a sequence of zero or more word groupings.

Detailed explanation-4: -A shift-reduce conflict occurs in a state that requests both a shift action and a reduce action. A reduce-reduce conflict occurs in a state that requests two or more different reduce actions.

Detailed explanation-5: -An LR-parser can detect a syntactic error as soon asa)The parsing startsb)It is possible to do so a left-to-right scan of the input. c)It is possible to do so a right-to-left scan of the input.

There is 1 question to complete.