Which of the following principle does stack use?

By: Prof. Dr. Fazal Rehman | Last updated: February 3, 2024

Which of the following principle does stack use?

(A). Linear data structure

(B). LIFO

(C). Hierarchical data structure

(D). None of these

Question’s Answer: LIFO

FIFO means first element added to the queue is the first one to be removed from queue.

Data Structure Principle
Stack LIFO
Queue FIFO
Array linear data structure without an inherent ordering principle
Tree hierarchical data structure without an inherent ordering principle
Linked List linear data structure without an inherent ordering principle

Example

Output

3 pushed into stack
7 pushed into stack
1 pushed into stack
1 Popped from stack
Top element is : 7
Elements present in stack : 7 3

All Copyrights Reserved 2025 Reserved by T4Tutorials