RG's E-Learning Centre · Book a free demo class · WhatsApp +91-9379416374

Queue operations: Class 12 practice

A queue is first-in, first-out (FIFO): enqueue adds at the rear and dequeue removes from the front.. The quick answer and an example come first; then the method, worked examples and six graded questions.

Queue operations: quick answer

A queue is first-in, first-out (FIFO): enqueue adds at the rear and dequeue removes from the front.

Example: 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)? Answer: Removed 77; left [37, 5, 30, 94].

  • Where it is taught: "Data Structures", Class 12 Computer Science.
  • On this page: the method, 3 worked examples and 6 graded questions with a full answer key.

How to use this page (about 30 minutes)

  1. Read the method once, then cover the worked examples and try them yourself before reading the steps.
  2. Do the two Basic questions without notes. If either is wrong, re-read the matching worked example.
  3. Do the Standard and Challenge questions, then check every line of working against the answer key — not only the final answer.
  4. Write down the mistake behind each wrong answer and redo that question the next day.

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

  1. Start with the given queue (front at the left).
  2. Apply operations in order.
  3. 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)?

  1. Removed: 77
  2. Left: [37, 5, 30, 94]
  3. 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)?

  1. Removed: 86, 70, 1, 17
  2. Left: []
  3. 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)?

  1. Removed: 32, 8
  2. Left: [41, 17, 1, 96, 57, 92]
  3. 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

  1. (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)?
  2. (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)?
  3. (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)?
  4. (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)?
  5. (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)?
  6. (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]

Which textbook this practice follows

This skill is taught under "Data Structures" in Class 12 Computer Science. Check your own textbook's contents page — CBSE, ICSE/ISC and state boards order chapters differently.

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.

Still stuck after the answer key?

If the same step in queue operations keeps going wrong, a short live 1 on 1 class can find the exact gap. The first demo class is free; send the class, board and chapter on WhatsApp (+91 9379416374).

Related practice and notes

More Class 12 Computer Science practice

Continue with this syllabus

Frequently asked questions

Which chapter is queue operations in?

This skill is taught under "Data Structures" in Class 12 Computer Science. Check your own textbook's contents page — CBSE, ICSE/ISC and state boards order chapters differently.

Which question should I start with?

Start with the Basic questions. Move to Standard only when both Basic answers match the key with the same working; the Challenge questions combine this skill with earlier ones.

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.

Is this only for CBSE?

The skill names follow NCERT/CBSE, but the method is the same for ICSE, state boards, IGCSE and IB. Only the chapter name and order differ.

Can I get live help with this topic?

Yes. RG's E-Learning teaches live 1 on 1 online classes; the first demo class is free and fees are shared after it.

Book a free demo class