- A A queue follows the Last-In-First-Out (LIFO) principle, while a stack follows the First-In-First-Out (FIFO) principle.
- B A queue allows elements to be inserted and removed from both ends, while a stack only allows elements to be inserted and removed from one end.
- C A queue is typically implemented using a linked list, while a stack is typically implemented using an array.
- D A queue is used for breadth-first search algorithms, while a stack is used for depth-first search algorithms.
- Share this MCQ
Answer:
B
Share this MCQ
Answer: b) A queue allows elements to be inserted and removed from both ends, while a stack only allows elements to be inserted and removed from one end.
Explanation: The primary difference between a queue and a stack is that a queue allows elements to be inserted and removed from both ends, while a stack only allows elements to be inserted and removed from one end. Additionally, a queue follows the First-In-First-Out (FIFO) principle, while a stack follows the Last-In-First-Out (LIFO) principle.
Click me to Read more Question & Answer of QueuesShare this MCQ