Skip to content

ISRO Scientist/Engineer CSE 2020Compiler Design › Parsing

ISRO Scientist/Engineer CSE 2020 PYQ: Given the grammar $s \rightarrow T ^{\ast} S\ \mid T$ $T \rightarrow U+T\ \mid U$ $U \rightarrow a \mid b$…

Given the grammar

  • $s \rightarrow T ^{\ast} S\ \mid T$
  • $T \rightarrow U+T\ \mid U$
  • $U \rightarrow a \mid b$

Which of the following statements is wrong?

  1. A
    Grammar is not ambiguous
  2. B
    Priority of $+$ over $^{\ast}$ is ensured
  3. C
    Right to left evaluation of $^{\ast}$ and $+$ happens
  4. D
    None of these
    Correct answer

Answer

(D) None of these

Approach

The question asks which statement is WRONG. Analyze each claim about the grammar: ambiguity, operator precedence, and associativity. The grammar is unambiguous, gives + higher precedence than *, and makes both operators right-associative (right-to-left evaluation). Thus all three statements are true, so the wrong statement is 'None of these'.

Reviewed by ISRO IQ Editorial Team.