Data Structures & AlgorithmsEasyWipro · Accenture pattern

Which data structure works on the Last In, First Out (LIFO) principle?

  1. A. Queue
  2. B. Stack
  3. C. Priority queue
  4. D. Hash table

Correct answer: B. Stack

A stack removes the most recently pushed item first (LIFO). A queue is FIFO, and a priority queue removes by priority, not by arrival order.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic