Which principle is followed by a stack data structure?

Options

  • A. FIFO
  • B. LIFO
  • C. LILO
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. LIFO

Detailed Explanation

Correct Answer: B. LIFO

Explanation: Stack follows the LIFO (Last In, First Out) principle.

  • The last inserted element is removed first.
  • Push inserts an element.
  • Pop removes the top element.

Example: A stack of plates.