1.

While evaluating a postfix expression, when an operator is encountered, what is the correct operation to be performed?(a) push it directly on to the stack(b) pop 2 operands, evaluate them and push the result on to the stack(c) pop the entire stack(d) ignore the operatorThis question is from Application of Stacks topic in section Application of Stacks of Data Structures & Algorithms II had been asked this question in homework.

Answer»

Right CHOICE is (B) pop 2 OPERANDS, evaluate them and push the result on to the stack

The explanation is: When an operator is encountered, the FIRST two operands are popped from the stack, they are evaluated and the result is PUSHED into the stack.



Discussion

No Comment Found

Related InterviewSolutions