Choose the equivalent prefix form of the following expression: (a + (b − c)) *…

2017

Choose the equivalent prefix form of the following expression: (a + (b − c)) * ((d − e) / (f + g − h))

Answer: A. * + a − b c / − d e − + f g hPrefix (Polish) notation writes every operator immediately before its two operands, and this placement is applied recursively — innermost parenthesized groups…

  1. A.

    * + a − b c / − d e − + f g h

  2. B.

    * + a − b c − / d e − + f g h

  3. C.

    * + a − b c / − e d + − f g h

  4. D.

    * + a b − c / − e d + − f g h

Attempted by 526 students.

Show answer & explanation

Correct answer: A

Prefix (Polish) notation writes every operator immediately before its two operands, and this placement is applied recursively — innermost parenthesized groups first, then working outward — so the position of each operator preserves the exact order of operations from the infix expression.

  1. Convert the innermost group (b − c) to prefix: − b c.

  2. Combine this with a using the addition operator: the group (a + (b − c)) becomes + a − b c.

  3. Convert the innermost group (d − e) to prefix: − d e.

  4. Convert the group (f + g − h), which associates as ((f + g) − h), to prefix: − + f g h.

  5. Combine steps 3 and 4 with the division operator: the group ((d − e) / (f + g − h)) becomes / − d e − + f g h.

  6. Combine steps 2 and 5 with the multiplication operator, since it is the outermost operation: * + a − b c / − d e − + f g h.

To verify, re-parse the resulting string from left to right, letting each operator absorb the next two completed sub-expressions: * pairs with (a + (b − c)) and ((d − e) / (f + g − h)), which rebuilds exactly (a + (b − c)) * ((d − e) / (f + g − h)) — the original expression, confirming the conversion.

The equivalent prefix form is * + a − b c / − d e − + f g h.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…