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

  1. A.

    − + − / a b c * d e * a c

  2. B.

    + − − / a b c * d e * a c

  3. C.

    − + / a b c − * d e * a c

  4. 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:

  1. ab and *de and *ac

  2. - /abc

  3. + - /abc *de

  4. - + - /abc de ac

Explore the full course: Niacl Ao It Specialist