What is the output of the following postfix expression? 5, 6, 2, +, *, 8, 4,…
2023
What is the output of the following postfix expression?
5, 6, 2, +, *, 8, 4, /, –
- A.
39
- B.
36
- C.
38
- D.
37
Attempted by 161 students.
Show answer & explanation
Correct answer: C
Evaluate the postfix expression using a stack.
6 and 2 are added to get 8; then 5 x 8 = 40.
8 and 4 are divided to get 2; finally 40 - 2 = 38.