What is the Polish notation (Prefix form) of the given infix expression?…

2021

What is the Polish notation (Prefix form) of the given infix expression?
(A∗B+C)/(E−F∗G)

Answer: B. /+*ABC–E*FGConceptIn prefix notation, each binary operator is written before its two operand subexpressions. The root operator comes from the outermost operation, while…

  1. A.

    +*/ABCE*FG

  2. B.

    /+*ABC–E*FG

  3. C.

    /ABC+*–E*FG

  4. D.

    +/ABC*–E*FG

Attempted by 832 students.

Show answer & explanation

Correct answer: B

Concept

In prefix notation, each binary operator is written before its two operand subexpressions. The root operator comes from the outermost operation, while precedence and parentheses determine the left and right subtrees.

Application

  1. Rewrite the grouping explicitly as ((A*B)+C)/(E−(F*G)). The outermost operation is division, so / is the root operator.

  2. In the numerator, A*B becomes * A B. Adding C gives + * A B C.

  3. In the denominator, F*G becomes * F G. Subtracting this product from E gives − E * F G.

  4. Place the numerator and denominator prefix strings after the root operator: / + * A B C − E * F G.

Cross-check

Parsing / + * A B C − E * F G recreates a division whose numerator is (A*B)+C and whose denominator is E−(F*G). Therefore the prefix form is /+*ABC−E*FG.

Explore the full course: Rssb Basic Computer Instructor

Loading lesson…