Which data structure is based on the Last In First Out (LIFO) principle?

Options

  • A. Stack
  • B. Linked List
  • C. Queue
  • D. Tree

Correct Answer (Detailed Explanation is Below)

A. Stack

Detailed Explanation

LIFO (Last In, First Out) means:

  • The element inserted last is removed first.

This principle is used in a Stack.

Example:

  • Push 10

  • Push 20

  • Push 30

  • Pop → 30 (last inserted, first removed)


❌ Other Options:

  •  Queue → Follows FIFO (First In, First Out)

  •  Linked List → Linear structure, does not strictly follow LIFO

  •  Tree → Hierarchical structure, not based on LIFO

OOps! You are currently offline.