ISRO Computer Science (CSE) 2009 - Question 27

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2009

Assume that the operators +, -, x are left associative and ^ is right associative. The postfix expression corresponding to a + b x c - d ^ e ^ f is

  • A. abc x + def ^ ^ -
  • B. abc x + de ^ f ^ -
  • C. ab + c x d - e ^ f ^
  • D. - + a x bc ^ ^ def -

Answer: A. abc x + def ^ ^ -

Explanation: Precedence: ^ > x > +,-. Right assoc of ^ means d^e^f is d^(e^f). Steps: a + (b*c) - (d^(e^f)) -> abc*+ def^^ -.

| | All questions of ISRO Computer Science (CSE) 2009