Which data structure is based on the Last In First Out (LIFO) principle?
Options
- A. Stack
- B. Linked List
- C. Queue
- D. Tree
A. Stack
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)
Queue → Follows FIFO (First In, First Out)
Linked List → Linear structure, does not strictly follow LIFO
Tree → Hierarchical structure, not based on LIFO
Attempt Quiz Now:
BPSC Tre 4.0 DSA Practice Set