Q3.Marks: +2.0UGC NET Paper 2: Computer Science 18th June 2024 Shift 1 (Cancelled)
An ambiguous grammar is one which has :
A. More than one derivations
B. More than one left most derivations
C. More than one right most derivations
D. More than one Parse tree
E. More than one syntax tree
Choose the correct answer from the options given below:
1.A and D Only
2.B and C Only✓ Correct
3.D and E Only
4.A and E Only
Solution
The correct answer is B and C Only
Key Points
A context-free grammar (CFG) is considered ambiguous if there exists a string in the language generated by the grammar that has more than one derivation tree, meaning it can have multiple Leftmost Derivation Trees (LMDTs) or Rightmost Derivation Trees (RMDTs).
Definition:
A CFG G = (V, T, P, S) is said to be ambiguous if and only if there is a string in T* that can be derived in more than one way, resulting in more than one parse tree.
- V is a finite set of variables (non-terminal symbols).
- T is a finite set of terminals (terminal symbols).
- P is a finite set of productions of the form \(A \rightarrow \alpha\) , where A is a variable and \alpha is a string of symbols from the set \((V \cup T)\)*.
- S is the designated start symbol from the set of variables.