Skip to main contentSkip to solution

Which of the following is NOT an application of the queue data structure?

Solution

✅ Correct Option: 4

Recursion is handled by the call stack, which is a stack (LIFO) structure. Each recursive call is pushed onto the stack and popped when it returns, so the most recent call finishes first. A queue is FIFO, so it is not used for recursion.


Options 1, 2 and 3: all serve requests in the order they arrive (first come, first served), which is exactly how a queue works. Print jobs, processes in the ready queue and incoming calls all wait in a queue.

Memory trick: undo, backtracking, recursion and bracket matching use a stack; scheduling, buffering and BFS use a queue.

Keyboard Shortcuts

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