Skip to main contentSkip to solution

Which of the following is an application of stack?

Solution

✅ Correct Option: 1

Converting an infix expression to postfix uses a stack to hold operators. An operator is pushed, and operators already on the stack with higher or equal precedence are popped to the output first. The stack's last-in-first-out (LIFO) order is what handles the precedence and bracket matching.


Options 2, 3 and 4: these are queue applications, because requests are served in the order they arrive (FIFO), not by LIFO.

Other common stack uses: undo/redo, balancing brackets, function call management (recursion) and reversing a string.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question