Recall & Review
beginner
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.
Click to reveal answer
beginner
Explain the FIFO principle in simple terms.
FIFO means the first element added is the first one to be removed, like people standing in a line waiting their turn.
Click to reveal answer
beginner
Which end of the queue do we add new elements to?
New elements are added at the back (also called the rear or tail) of the queue.
Click to reveal answer
beginner
Which end of the queue do we remove elements from?
Elements are removed from the front (also called the head) of the queue.
Click to reveal answer
beginner
Give a real-life example of a queue using the FIFO principle.
A line at a grocery store checkout is a queue: the first person to get in line is the first to be served and leave.
Click to reveal answer
In a queue, where do you add new elements?
✗ Incorrect
New elements are always added at the back of the queue.
What does FIFO stand for in queues?
✗ Incorrect
FIFO means the first element added is the first one removed.
If you add elements 1, 2, 3 in order to a queue, which will be removed first?
✗ Incorrect
The first element added (1) is removed first following FIFO.
Which operation removes an element from a queue?
✗ Incorrect
Dequeue removes the front element from the queue.
What real-life situation is similar to a queue?
✗ Incorrect
A line at a ticket counter is a perfect example of a queue.
Describe how elements are added and removed in a queue using the FIFO principle.
Think about how people wait in line.
You got /4 concepts.
Give a simple real-life example that shows how a queue works.
Where do people wait their turn?
You got /4 concepts.