WBJECA 2025 — Computer PYQ
WBJECA | Computer | 2025Which of the following is not a typical use of stacks?
Choose the correct answer:
- A.
Expression evaluation
- B.
Undo mechanism in editors
- C.
Recursion function call management
- D.
Breadth-first search traversal
(Correct Answer)
Breadth-first search traversal
Explanation
To understand why, we look at the underlying data structure requirements for each algorithm. A Stack follows the LIFO (Last-In-First-Out) principle, whereas a Queue follows the FIFO (First-In-First-Out) principle.
The operational logic for these structures can be represented as:
Stack: Push(item)→Pop(item) (LIFO)
Queue: Enqueue(item)→Dequeue(item) (FIFO)
Here is how the options align:
(A), (B), and (C) are classic applications of a Stack because they require reversing the order of operations or keeping track of the most recent state.
(D) Breadth-first search (BFS) is fundamentally designed to visit nodes level-by-level, which requires the FIFO behavior of a Queue. Mathematically, for a graph G with vertices V, BFS ensures:
Distance(v1)≤Distance(v2)
for any nodes processed sequentially in the queue.

