MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
A grammar that is both left and right recursive for a non-terminal is
A
Ambiguous
B
Unambiguous
C
Information is not sufficient to decide whether it is ambiguous or Unambiguous.
D
None of the above
Explanation: 

Detailed explanation-1: -Solutions for A grammar that is both left and right recursive for a non-terminal, isa)Ambiguousb)Unambiguousc)Information is not sufficient to decide whether it is ambiguous or unambiguousd)None of the aboveCorrect answer is option ā€˜Cā€™.

Detailed explanation-2: -A production can be recursive without being either left-or right-recursive, and it can even be both left-and right-recursive.

Detailed explanation-3: -The grammar which is either left recursive or right recursive is always unambiguous.

Detailed explanation-4: -With right recursion, no reduction takes place until the entire list of elements has been read; with left recursion, a reduction takes place as each new list element is encountered. Left recursion can therefore save a lot of stack space.

Detailed explanation-5: -NOTE. A non-recursive grammar has neither left recursion nor right recursion.

There is 1 question to complete.