---
title: "Evaluate postfix expression 574-*8/4+"
subject: "Data Structure and Algorithm"
chapter: 2
key: "semester_4/data_structure_and_algorithm:postfix-evaluate-574"
source: https://www.bctengineer.com/q/semester_4/data_structure_and_algorithm/postfix-evaluate-574
site: BCT Engineering
---

# Evaluate postfix expression 574-*8/4+

Data Structure and Algorithm · Chapter 2: The Stack and Queue

- Asked in: 2069 Bhadra, 5 marks
- Video: [Evaluation of postfix expression using stack || 2078 question solution ||](https://www.youtube.com/watch?v=YTPJuQWu-EQ) — GUPTA TUTORIAL
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_4/data_structure_and_algorithm/postfix-evaluate-574
- Whole chapter: https://www.bctengineer.com/md/semester_4/data_structure_and_algorithm/chapter-2

## Question

Evaluate the following postfix expression showing stack after every step in tabular form: 574-*8/4+

## Short answer

Step-by-step evaluation: push 5,7,4; 7-4=3; 5*3=15; 15/8=1.875; 1.875+4=5.875. Final value: 5.875.

## Answer

Rule: scan left to right; a digit is an operand and is pushed; an operator pops two values (the first popped is the right operand), applies the operation and pushes the result. Each digit is a separate one-digit operand.

| Step | Symbol | Action | Stack (bottom → top) |
|---|---|---|---|
| 1 | 5 | push 5 | 5 |
| 2 | 7 | push 7 | 5, 7 |
| 3 | 4 | push 4 | 5, 7, 4 |
| 4 | - | pop 4 (right), 7 (left); 7 - 4 = 3; push | 5, 3 |
| 5 | * | pop 3 (right), 5 (left); 5 * 3 = 15; push | 15 |
| 6 | 8 | push 8 | 15, 8 |
| 7 | / | pop 8 (right), 15 (left); 15 / 8 = 1.875; push | 1.875 |
| 8 | 4 | push 4 | 1.875, 4 |
| 9 | + | pop 4 (right), 1.875 (left); 1.875 + 4 = 5.875; push | 5.875 |

**Answer: 5.875** (using real division: 5 × 3 = 15, 15 / 8 = 1.875, 1.875 + 4 = 5.875). With integer division, 15 / 8 = 1 and the result is 5. Infix form: `5 * (7 − 4) / 8 + 4`.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. In postfix evaluation, what is done when an operand (digit) is scanned?
   A. It is pushed on the stack
   B. Two values are popped
   C. It is added to the output string
   D. It is ignored until an operator comes
   Answer: A. Operands are pushed; operators pop two values. (Key point: Evaluation rule)

2. In 574-*8/4+, what does the first '-' compute?
   A. 5 - 7
   B. 4 - 7
   C. 7 - 4 = 3
   D. 5 - 4
   Answer: C. Stack is 5,7,4; pop 4 (right) and 7 (left) giving 7-4 = 3. (Key point: First operator)

3. After 5*3 = 15, what does '/' compute with 8?
   A. 8 / 15
   B. 15 / 8 = 1.875
   C. 15 * 8
   D. 15 - 8
   Answer: B. The first popped (8) is the right operand so it is 15/8 = 1.875. (Key point: Real division step)

4. What is the final result using real division?
   A. 5
   B. 5.875
   C. 4
   D. 19
   Answer: B. 1.875 + 4 = 5.875; integer division would give 1+4 = 5. (Key point: Final answer)

## Related in Data Structure and Algorithm

- [Convert expression to prefix and postfix](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Ainfix-prefix-postfix-tabular) — Data Structure and Algorithm, chapter 2
- [Importance of postfix; convert expression](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Apostfix-importance-conversion) — Data Structure and Algorithm, chapter 2
- [Convert and evaluate A/B-(C+D)*E](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Apostfix-evaluate-ab-slash-cd-e) — Data Structure and Algorithm, chapter 2, asked 2×
- [Convert and evaluate (A+B)*(C-D)](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Apostfix-evaluate-ab-cd) — Data Structure and Algorithm, chapter 2, asked 2×
- [Convert expression to prefix and postfix](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Aprefix-postfix-abcdefgk) — Data Structure and Algorithm, chapter 2
- [Infix to postfix and evaluation](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Ainfix-postfix-explain-evaluate) — Data Structure and Algorithm, chapter 2

## Related in other subjects

- [FM expression after change of modulating signal](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Afm-new-waveform-500hz-2khz) — Communication Systems, chapter 3
- [IRR with unrecovered balance, graphical and tabular](https://www.bctengineer.com/question.md?key=semester_6%2Fengineering_economics%3Airr-unrecovered-balance-250000) — Engineering Economics, chapter 3
- [Every RE has NFA; ε-NFA for bb(a∪b)*ab](https://www.bctengineer.com/question.md?key=semester_3%2Ftheory_of_computation%3Are-to-nfa-bb-aub-ab) — Theory of Computation, chapter 2
- [Maximum ground-level concentration from a stack](https://www.bctengineer.com/question.md?key=semester_7%2Fenvironment_and_pollution_control%3Amaximum-ground-level-concentration) — Environment and Pollution Control, chapter 2
