Recall & Review
beginner Click to reveal answer
What is a Queue in data structures?
A Queue is a collection where elements are added at the back and removed from the front, following the First In First Out (FIFO) principle.
beginner Click to reveal answer
Explain the FIFO principle in simple terms.
FIFO means the first element added is the first one to be removed, like people lining up in a queue at a store.
beginner Click to reveal answer
Which operations are common in a Queue?
Common operations are enqueue (add to back), dequeue (remove from front), peek (see front element), and isEmpty (check if queue is empty).
beginner Click to reveal answer
What happens if you try to dequeue from an empty queue?
Trying to dequeue from an empty queue usually returns null or undefined, meaning there is nothing to remove.
beginner Click to reveal answer
How is a Queue different from a Stack?
A Queue removes elements in FIFO order, while a Stack removes elements in Last In First Out (LIFO) order.
What does FIFO stand for in the context of a queue?
✗ Incorrect
FIFO means the first element added is the first one to be removed.
In a queue, where do new elements get added?
✗ Incorrect
New elements are added at the back of the queue.
Which operation removes an element from a queue?
✗ Incorrect
Dequeue removes the front element from the queue.
If a queue has elements 1, 2, 3 in order, which element will be removed first?
✗ Incorrect
The first element added (1) is removed first following FIFO.
What will peek operation in a queue do?
✗ Incorrect
Peek shows the front element without removing it.
Describe how a queue works using a real-life example.
Think about how people wait in line.
You got /4 concepts.
List and explain the main operations of a queue.
Focus on adding, removing, checking front, and checking if empty.
You got /5 concepts.
