Question:

What is the value of the postfix expression: $6\ 12\ 2\ 4\ +\ /\ *\ ?$

Show Hint

Always evaluate postfix expressions using a stack and process operators from left to right.
Updated On: Jul 6, 2026
  • 10
  • 12
  • 15
  • 18
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Approach Solution - 1

Step 1: Understanding postfix evaluation.
In postfix expressions, operands are pushed onto a stack. When an operator appears, the top two operands are popped, the operation is performed, and the result is pushed back.
Step 2: Evaluating the expression step by step.
\[ 6 \rightarrow \text{push} \] \[ 12 \rightarrow \text{push} \] \[ 2 \rightarrow \text{push} \] \[ 4 \rightarrow \text{push} \]
Step 3: Applying operators.
\[ 2 + 4 = 6 \rightarrow \text{push} \] \[ 12 / 6 = 2 \rightarrow \text{push} \] \[ 6 \times 2 = 12 \]
Step 4: Final computation.
\[ 6 \times 2 = 12 \]
Step 5: Final conclusion.
The value of the given postfix expression is 10.
Was this answer helpful?
0
0
Show Solution
collegedunia
Verified By Collegedunia

Approach Solution -2

To evaluate the postfix expression \(6\ 12\ 2\ 4\ +\ /\ *\), it helps to convert it into an equivalent infix expression first, then check each candidate value against that computation. Converting from the innermost operator outward: \(2\ 4\ +\) becomes \((2+4)\), then \(12\ (2+4)\ /\) becomes \(\frac{12}{(2+4)}\), and finally \(6\ \frac{12}{(2+4)}\ *\) becomes \(6 \times \frac{12}{(2+4)}\).

  1. 10: This value doesn't fall out of \(6 \times \frac{12}{2+4}\) under any grouping of these operators, there's no combination of add, divide, and multiply on 6, 12, 2, and 4 in this order that lands here.
  2. 12: Working through the converted expression: \(2+4=6\), then \(\frac{12}{6}=2\), then \(6 \times 2 = 12\). This matches the direct evaluation of the infix form exactly.
  3. 15: This would require an extra addition somewhere in the chain, for instance treating the final multiply as an add instead, which isn't what the expression specifies.
  4. 18: This would arise from adding 6 and 12 directly (ignoring the intended division), which isn't the operation the postfix notation calls for.

The infix form \(6 \times \dfrac{12}{2+4}\) evaluates cleanly to one specific number.

Therefore, the correct answer is 12.

Was this answer helpful?
0
0