The infix expression A + (B - C)* D is correctly represented in prefix…

2009

The infix expression A + (B - C)* D is correctly represented in prefix notation as

  1. A.

    A + B − C ∗ D

  2. B.

    + A ∗ − B C D

  3. C.

    A B C − D ∗ +

  4. D.

    A + B C − D ∗

Attempted by 467 students.

Show answer & explanation

Correct answer: B

To convert the infix expression A + (B - C) * D to prefix notation, follow these steps based on operator precedence: 1. Evaluate the innermost parentheses first: (B - C) becomes - B C in prefix. 2. Perform the multiplication next: The result from step 1 multiplied by D becomes * - B C D. 3. Finally, perform the addition: A added to the result from step 2 becomes + A * - B C D. Thus, the correct prefix notation is + A * - B C D.

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

Explore the full course: Isro