While conversion of an Infix notation to its equivalent Prefix/Postfix notation, only ________ are ______ onto the stack.
While conversion of an Infix notation to its equivalent Prefix/Postfix notation, only ________ are ______ onto the stack.
Solution
While converting infix to postfix or prefix, operands go straight to the output. Only operators (and parentheses) are PUSHed onto the stack, and they are POPed to the output according to precedence and associativity.
For example, becomes . Here , , go to the output directly, while and wait on the stack.
Option 1: operands are never stacked in this conversion. They are written to the output as soon as they are read. (Operands are pushed only when evaluating a postfix or prefix expression.)
Options 3 and 4: POP is the step that moves operators from the stack to the output, so it is not the operation that "puts onto" the stack.
Related questions:
2026: 29 May Shift 1
2025: 20 May Shift 1
2026: 18 May Shift 2