The prefix equivalent of the following infix expression is: a / b − c + d * e…
2017
The prefix equivalent of the following infix expression is:
a / b − c + d * e − a * c
- A.
− + − / a b c * d e * a c
- B.
+ − − / a b c * d e * a c
- C.
− + / a b c − * d e * a c
- D.
− − + / a b c * d e * a c
Attempted by 347 students.
Show answer & explanation
Correct answer: A
To find the prefix equivalent, parenthesize the expression based on operator precedence (*, / higher than + , -) and associativity (left-to-right):
(((a / b) - c) + (d*e)) - (a*c)
Move operators to the front of their operands step-by-step:
ab and *de and *ac
- /abc
+ - /abc *de
- + - /abc de ac