The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?

A.

600

B.

350

C.

650

D.

588

Answer: Option B

Explanation:

The postfix expression is evaluated using stack. We will get the infix expression as (5*(4+6))*(4+9/3). On solving the Infix Expression, we get (5*(10))*(4+3) = 50*7 = 350.

Convert the following infix expressions into its equivalent postfix expressions (A + B ⋀D)/(E – F)+G?

A.

(A B D ⋀ + E F – / G +)

B.

(A B D +⋀ E F – / G +)

C.

(A B D ⋀ + E F/- G +)

D.

(A B D E F + ⋀ / – G +)

Answer: Option A

Explanation:

The given infix expression is (A + B ⋀D)/(E – F)+G. (A B D ^ + ) / (E – F) +G (A B D ^ + E F – ) + G. ‘/’ is present in stack. A B D ^ + E F – / G +. Thus Postfix Expression is A B D ^ + E F – / G +.

Convert the following Infix expression to Postfix form using a stack x + y * z + (p * q + r) * s, Follow usual precedence rule and assume that the expression is legal?

A.

xyz*+pq*r+s*+

B.

xyz*+pq*r+s+*

C.

xyz+*pq*r+s*+

D.

xyzp+**qr+s*+

Answer: Option A

Explanation:

The Infix Expression is x + y * z + (p * q + r) * s. (x y z ) + (p * q + r) * s. ‘+’, ‘*’ are present in stack. (x y z * + p q * r) * s. ‘+’ is present in stack. x y z * + p q * r + s * +. Thus Postfix Expression is x y z * + p q * r + s * +.

The type of expression in which operator succeeds its operands is?

A.

Infix Expression

B.

Prefix Expression

C.

Postfix Expression

D.

All of Above

Answer: Option C

Explanation:

The expression in which operator succeeds its operands is called postfix expression. The expression in which operator precedes the operands is called prefix expression. If an operator is present between two operands, then it is called infix expressions.