MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

THEORY OF COMPUTATION

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Consider the grammar G have productions S
A
Yes
B
No
C
Either A or B
D
None of the above
Explanation: 

Detailed explanation-1: -A Grammar that makes more than one Leftmost Derivation (or Rightmost Derivation) for the similar sentence is called Ambiguous Grammar.

Detailed explanation-2: -A grammar is said to be ambiguous if there exists more than one leftmost derivation or more than one rightmost derivation or more than one parse tree for the given input string. If the grammar is not ambiguous, then it is called unambiguous. If the grammar has ambiguity, then it is not good for compiler construction.

Detailed explanation-3: -The correct answer is option 4. The grammar S → SS | a is ambiguous grammar. It generates two parse trees with string aaa.

Detailed explanation-4: -Explanation: A context free grammar is ambiguous if it has more than one parse tree generated or more than one leftmost derivations. An unambiguous grammar is a context free grammar for which every valid string has a unique leftmost derivation. 2.

There is 1 question to complete.