All Exams Test series for 1 year @ ₹349 only
Question

How many PUSH and POP operations will be needed to evaluate the following expression by reverse polish notation in a stack machine \((A * B) + (C * D/E)\) ?

This question was previously asked in
UGC NET 2014 Paper 2 Computer Science and Applications Question Paper (28-Dec-2014)
The correct answer is

5 PUSH and 4 POP instructions

In a stack machine, an expression is evaluated in reverse polish (postfix) form: each operand is pushed onto the stack, and each binary operator pops its operands from the top of the stack, combines them and leaves the result on top.

The postfix form of \((A * B) + (C * D/E)\) is \(A\,B * C\,D\,E / * +\) (or \(A\,B * C\,D * E / +\)); either way it has 5 operands and 4 operators.

Each operand needs one PUSH: A, B, C, D, E give 5 PUSH operations.

Each operator performs one POP step that takes its operands off the stack: the multiplications \(A*B\) and the one with C, the division by E and the final addition give 4 POP operations, after which only the result remains.

Hence, the answer is 5 PUSH and 4 POP instructions.

Was this answer helpful?

Similar Questions

  1. What is the maximum number of parenthesis that will appear on the stack at any one time for parenthesis expression given by

    ( ( )   ( ( ) )   ( ( ) ) )


Important Questions from Stack

  1. Single array a[0: MAXSIZE - 1] is used to implement two stacks. The two stacks grow from apposite ends of the array. Variables top 1 and top 2 (top1 < top2) point to the location of the topmost element in each of the stacks if the space is to be used efficiently, The condition for "stack full" is____________.

  2. Match the following :
    (1) PUSH(a) STACK
    (2) FIFO(b) Stack insertion
    (3) POP(c) QUEUE
    (4) LIFO(d) Stack deletion
  3. What is the final value of the postfix expression BCDAD-+-+.
    where A=2, B=3, C=4, D=5.
  4. Consider the following operations performed on a stack of size 5 :
    Push (a); Pop() ; Push(b); Push(c); Pop();
    Push(d); Pop();Pop(); Push (e)
    Which of the following statements is correct ?
  5. Which of the following is not an inherent application of stack ?
Need Expert Advice?
Upcoming Exams
CTET
December 12, 2026
WB SET
December 13, 2026
CBSE UGC NET
December 14, 2026
CSIR UGC NET
December 19, 2026
Test Series
UGC NET img
Teaching
UGC NET (Paper 2) December 2026 Mock Test Series
799 Tests 2 Tests Free
299 Attempts
4.4(45)
English, Hindi
More Questions from UGC NET

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App