Which of the following is the main advantage of a stack over a queue?

Options

  • A. It follows FIFO order
  • B. It provides Last In First Out access
  • C. It always requires less memory
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. It provides Last In First Out access

Detailed Explanation

Correct Answer: B. It provides Last In First Out access

Explanation: A stack provides LIFO access, whereas a queue provides FIFO access.

  • Stack: Last inserted element is removed first.
  • Queue: First inserted element is removed first.
  • Neither data structure always requires less memory.