Which of the following principle does queue use?

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

Which of the following principle does queue use?

(A). LIFO

(B). FIFO

(C). Both

(D). None of these

Question’s Answer: FIFO

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

Data StructurePrinciple
QueueFIFO
StackLIFO
Arraylinear data structure without an inherent ordering principle
Treehierarchical data structure without an inherent ordering principle
Linked Listlinear data structure without an inherent ordering principle

Example

Output

Queue size: 2
Front element: 5
Back element: 8
Queue size after two pops: 0
Queue is empty