Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which is the post fix notation of (9 - 5) + 2

  • A.59 - 2 +
  • B.95 - 2 +
  • C.2 + 95 -
  • D.92 + 5 -

Answer: B

The postfix notation is 95 - 2 +.

In postfix each operator follows its two operands. Convert the inner expression first, then the outer one:

\[ \begin{aligned} (9 - 5) &\to 9\ 5\ - \\ (9 - 5) + 2 &\to 9\ 5\ -\ 2\ + \end{aligned} \]

Evaluating it on a stack gives 9 - 5 = 4 and then 4 + 2 = 6, as the original does. '59 -' would compute 5 - 9, the operands reversed, '2 + 95 -' puts an operator before its operands, and '92 + 5 -' computes 9 + 2 - 5, a different expression.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.