aimnova.
DashboardMy LearningPaper MasteryStudy Plan

Aimnova site navigation

Stay in the loop

Get the latest study resources and updates

New features, study tips and exam insights — straight to your inbox.

IB Diploma

  • IB Past Papers
  • IB Study Notes
  • IB Question Bank
  • IB Mock Exams
  • IB Revision

IB Subjects

  • IB Math AA
  • IB Math AI
  • IB Economics
  • IB Business Management
  • IB Physics
  • IB Biology
  • View all IB subjects→

IB Past Papers

  • IB Math AA HL Past Papers
  • IB Math AA SL Past Papers
  • IB Math AI HL Past Papers
  • IB Math AI SL Past Papers
  • IB Economics HL Past Papers
  • IB Economics SL Past Papers
  • IB ESS Past Papers
  • View all past papers→

Study Resources

  • Study Notes
  • Question Bank
  • Mock Exams
  • Flashcards
  • Revision Guide
  • Exam Skills
  • Command Terms
  • Grade Calculator
  • Exam Timetable 2026

Aimnova

  • Features
  • Pricing
  • For Schools
  • For Parents
  • About Us
  • Blog
  • Contact
aimnova.

AI-powered study platform for smarter revision, past-paper analysis and examiner-style feedback.

TermsPrivacyCookies·© 2026 Aimnova. All rights reserved.8afc4e3

Aimnova is not affiliated with or endorsed by the International Baccalaureate Organization (IB).

NotesComputer ScienceTopic 6.2Queues (FIFO)
Back to Computer Science Topics
6.2.44 min read

Queues (FIFO)

IB Computer Science • Unit 6

AI-powered feedback

Stop guessing — know where you lost marks

Get instant, examiner-style feedback on every answer. See exactly how to improve and what the markscheme expects.

Try It Free

Contents

  • Whoever waited longest goes first
  • The four operations
  • What queues are actually for
  • Exam-style question
The big idea: A queue is added to at one end and taken from at the other.

So the first item in is the first out — FIFO. Nobody who arrived later can get ahead.

Compare the two halves: the same items in, and the opposite order back out.

Interactive diagram

Explore the labelled diagram, charts and maps for this topic in full study mode.

Claim your free topic

Free preview

This is the free notes preview

You're reading the free notes. Aimnova Pro unlocks the full study experience — and you can try it with your first topic free to keep:

  • FlashcardsLock in vocabulary and key terms with spaced repetition.
  • Practice questionsAnswer exam-style questions and get instant AI marking.
  • Mock exams & past-paper vaultSit full mocks and see exactly how examiners award marks.
  • Personalised study planA daily plan built around your exam date and weak areas.
Start Studying Free Full access to Aimnova Pro · cancel anytime

enqueue and dequeue

  • enqueue(item) — join at the back
  • dequeue() — leave from the front, and return
  • Two different ends, which is the whole difference from a stack
  • Both are O(1) when implemented properly

front and isEmpty

  • front() — look at the next one out, without removing it
  • isEmpty() — is anyone waiting?
  • Check isEmpty before dequeuing
  • Dequeuing an empty queue is an error

What makes it fair

  • Order of arrival is preserved exactly
  • Nothing can jump ahead
  • That fairness is why it is used for shared resources
Why not a plain list: Removing from the front of an ordinary list means shifting every remaining item down one place — O(n) every time.

A proper queue structure removes from the front in constant time, which is why Python offers deque for the job.

Get feedback like a real examiner

Submit your answers and get instant feedback — what you did well, what's missing, and exactly what to write to score full marks.

Try AI Tutor FreeYour first topic is free to keep • No credit card required
1

Print jobs

2

Processes waiting for the CPU

3

Buffering data

4

Breadth-first exploration

Stack or queue, in one question: Does the most recent item matter most, or the one that has waited longest?

Most recent → stack. Longest waiting → queue. Every question here is that question in disguise.

How this is tested — you must justify FIFO from the scenario and say what a stack would get wrong. It comes up two ways:

Paper 2 — working with code

  • Explain a queue and its operations, 3-5 marks
  • Trace a sequence of enqueues and dequeues
  • Choose between a stack and a queue

Paper 2 — the algorithmic-thinking question

  • Decide from described behaviour, with no code shown
  • Explain the consequence of choosing the wrong one
The classic trap: Describing a queue as "a list that things are added to". The mark is for the two ends: joining at the back and leaving from the front, so order of arrival is preserved.
IB-style questionExplain[5 marks]

A hospital reception system handles patients arriving for a walk-in clinic. Explain why a queue suits this, and what would happen with a stack.

Model answer plan

See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.

Claim your free topic

Try an IB Exam Question — Free AI Feedback

Test yourself on Queues (FIFO). Write your answer and get instant AI feedback — just like a real IB examiner.

the term queue. [1 mark]

Related Computer Science Topics

Continue learning with these related topics from the same unit:

6.1.1Variables and data types
6.1.2Substrings
6.1.3Exception handling
6.1.4Debugging
View all Computer Science topics

Improve your exam technique

Command terms, paper structure, and mark-scheme tips for Computer Science

Previous
6.2.3Stacks (LIFO)
Next
Sequence6.3.1

20 exam-style questions ready for you

Students who practice on Aimnova improve their scores by 15% on average. Get instant feedback that shows exactly how to improve your answers.

Practice Now — FreeView All Computer Science Topics