Open In App

ISRO | ISRO CS 2009 | Question 27

Last Updated : 05 Jun, 2018
Like Article
Like
Save
Share
Report

Assume that the operators +, −, × are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^, ×, +, −. The postfix expression corresponding to the infix expression is

a + b × c − d ^ e ^ f

(A) abc x + def ^ ^ −
(B) abc x + de ^ f ^ −
(C) ab + c × d − e^f^
(D) − + a × b c^^ def


Answer: (A)

Explanation: The postfix expression:

a + b × c − ( d ^( e ^ f))
a + b × c − ( d ^( e f ^ ))
a + b × c − ( d e f ^ ^)
(a + (b × c)) − d  e f ^ ^
(a + (b c x)) − d  e f ^ ^
(a (b c x) +) − d  e f ^ ^
(a b c x +) - (d e f ^ ^)
(a b c x +) - (d e f ^ ^)
a b c x + d e f ^ ^ -

So, option (A) is correct.

Quiz of this Question


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads