Skip to main contentSkip to solution

What will be the output in postfix notation of the following infix notation:-

x * y + z 3 *(4 + 5) (x + y)/(z * 5)

Solution

✅ Correct Option: 2

Postfix places each operator after its two operands. Brackets are done first, and * and / are applied before +.

InfixWorkingPostfix
x∗y+zx * y + zxy∗xy* is formed first, then +z+ zxy*z+
3∗(4+5)3 * (4 + 5)bracket gives 45+45+, then 33 and ∗*345+*
(x+y)/(z∗5)(x + y)/(z * 5)xy+xy+ and z5∗z5*, then //xy+z5*/

Joining the three gives xyz+ 345+ xy+z5*/.


Options 1 and 3: the operators come before their operands, which is prefix form, not postfix.

Option 4: "345++*" is invalid, because the second + has no operand left, and the extra * at the end has no operands either.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question