Queue operations: Class 12 practice
A queue is first-in, first-out (FIFO): enqueue adds at the rear and dequeue removes from the front.. Read the method, follow the three worked examples, then try the six questions.
What you should know first
- Lists
The idea behind queue operations
A queue is first-in, first-out (FIFO): enqueue adds at the rear and dequeue removes from the front.
Step-by-step method
- Start with the given queue (front at the left).
- Apply operations in order.
- Record dequeued values and the final queue.
Worked example 1 (Basic)
Starting with an empty queue, perform: enqueue(77), enqueue(37), enqueue(5), enqueue(30), dequeue(), enqueue(94). What is removed and what is left (front → rear)?
- Removed: 77
- Left: [37, 5, 30, 94]
- Answer: Removed 77; left [37, 5, 30, 94]
Worked example 2 (Standard)
Starting with an empty queue, perform: enqueue(86), dequeue(), enqueue(70), dequeue(), enqueue(1), dequeue(), enqueue(17), dequeue(). What is removed and what is left (front → rear)?
- Removed: 86, 70, 1, 17
- Left: []
- Answer: Removed 86, 70, 1, 17; left []
Worked example 3 (Challenge)
Starting with an empty queue, perform: enqueue(32), enqueue(8), enqueue(41), dequeue(), enqueue(17), enqueue(1), enqueue(96), enqueue(57), dequeue(), enqueue(92). What is removed and what is left (front → rear)?
- Removed: 32, 8
- Left: [41, 17, 1, 96, 57, 92]
- Answer: Removed 32, 8; left [41, 17, 1, 96, 57, 92]
Common mistakes and misconceptions
- Removing from the rear
- Mixing up front and rear
Practice questions
- (Basic) Starting with an empty queue, perform: enqueue(69), enqueue(35), enqueue(89), enqueue(60), enqueue(74), enqueue(99). What is removed and what is left (front → rear)?
- (Basic) Starting with an empty queue, perform: enqueue(3), enqueue(67), dequeue(), enqueue(9), enqueue(60), enqueue(31). What is removed and what is left (front → rear)?
- (Standard) Starting with an empty queue, perform: enqueue(65), enqueue(85), enqueue(11), enqueue(3), enqueue(14), dequeue(), enqueue(95), dequeue(). What is removed and what is left (front → rear)?
- (Standard) Starting with an empty queue, perform: enqueue(3), dequeue(), enqueue(90), dequeue(), enqueue(59), dequeue(), enqueue(42), enqueue(99). What is removed and what is left (front → rear)?
- (Challenge) Starting with an empty queue, perform: enqueue(25), dequeue(), enqueue(41), enqueue(49), dequeue(), enqueue(24), enqueue(83), dequeue(), dequeue(), enqueue(2). What is removed and what is left (front → rear)?
- (Challenge) Starting with an empty queue, perform: enqueue(41), enqueue(34), dequeue(), enqueue(21), enqueue(3), enqueue(92), dequeue(), enqueue(75), dequeue(), enqueue(43). What is removed and what is left (front → rear)?
Answer key with full working
- Q1: Removed: none → Left: [69, 35, 89, 60, 74, 99] → Answer: Removed none; left [69, 35, 89, 60, 74, 99]
- Q2: Removed: 3 → Left: [67, 9, 60, 31] → Answer: Removed 3; left [67, 9, 60, 31]
- Q3: Removed: 65, 85 → Left: [11, 3, 14, 95] → Answer: Removed 65, 85; left [11, 3, 14, 95]
- Q4: Removed: 3, 90, 59 → Left: [42, 99] → Answer: Removed 3, 90, 59; left [42, 99]
- Q5: Removed: 25, 41, 49, 24 → Left: [83, 2] → Answer: Removed 25, 41, 49, 24; left [83, 2]
- Q6: Removed: 41, 34, 21 → Left: [3, 92, 75, 43] → Answer: Removed 41, 34, 21; left [3, 92, 75, 43]
Syllabus note
This skill is listed under "Data Structures" for Class 12 in the NCERT/CBSE books. ICSE, IGCSE, IB and state boards may teach it in a different chapter or year.
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.
Related practice and notes
Frequently asked questions
Which chapter is queue operations in?
"Data Structures", Class 12 Computer Science (NCERT/CBSE). Other boards may place it differently.
How were the answers checked?
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.