1.

Assume that the operators +,-, X are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^, X, +, -. The postfix expression for the infix expression a + b X c – d ^ e ^ f is?(a) abc X+ def ^^ –(b) abc X+ de^f^ –(c) ab+c Xd – e ^f^(d) -+aXbc^ ^defPlease solve with an explanation.

Answer»

Correct option is (b) abc X+ de^F^ –

Easy explanation - GIVEN Infix Expression is a + b X c – d ^ e ^ f.

(a b c X +) (d ^ e ^ f). ‘–‘ is present in STACK.

(a b c X + d e ^ f ^ -). Thus the final expression is (a b c X + d e ^ f ^ -).



Discussion

No Comment Found

Related InterviewSolutions