The dangling else ambiguity is normally resolved by
Answer: C
Either the grammar is rewritten to distinguish matched from unmatched statements, or the parser generator is told to prefer shifting the else. Both realise the same nearest if rule. Languages requiring an explicit end keyword avoid the ambiguity altogether.
Please log in or register to report this question.