MENU
Question -

Evaluate the following postfix expression : (show status of Stack after each operation)
100,40,8,/,20,10,-,+,*



Answer -

ITEM

SCANNED

OPERATION

STACK

100

PUSH 100

100

40

PUSH 40

100,40

8

PUSH 8

100,40,8

/

POP 8
POP 40
EVALUATE 40/8 =5
PUSH 5

100,5

20

PUSH 20

100,5,20

10

PUSH 10

100, 5, 20, 10

POP 10
POP 20
EVALUATE 20-10 =10
PUSH 10

100,5,10

+

POP 10 POP 5
EVALUATE 10 + 5= 15 PUSH 15

100,15

*

POP 15
POP 100
EVALUATE 100 * 15 = 1500
PUSH 1500

1500

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×