Skip to content
Computer Science · Grade 12

Active learning ideas

Queues: FIFO Principle

Active learning helps students grasp the FIFO principle because queues are abstract until connected to concrete experiences. Physical simulations and coding activities make the order of operations visible, reducing confusion about where elements enter and leave the structure.

Ontario Curriculum ExpectationsCS.DSAA.6CS.P.6
30–50 minPairs → Whole Class4 activities

Activity 01

Simulation Game30 min · Small Groups

Simulation Game: Card Queue Line-Up

Provide index cards labeled with tasks or customers. Students enqueue by placing cards at the back of a line on desks, dequeue by removing from the front, and record states after each operation. Extend to simulate high-volume arrivals and discuss bottlenecks.

How do priority queues differ from standard queues in real-world scheduling?

Facilitation TipDuring the Card Queue Line-Up, circulate and challenge students to predict outcomes if someone tries to remove from the middle, reinforcing FIFO rules.

What to look forPresent students with a sequence of enqueue and dequeue operations (e.g., enqueue(A), enqueue(B), dequeue(), enqueue(C), dequeue(), dequeue()). Ask them to write down the state of the queue after each operation and list the elements dequeued in order.

ApplyAnalyzeEvaluateCreateSocial AwarenessDecision-Making
Generate Complete Lesson

Activity 02

Coding: Build Queue Class

Pairs implement a Queue class in Python or Java with enqueue, dequeue, peek, and size methods using a list. Test with 10-15 operations, including edge cases like empty queues. Debug and compare run times for large inputs.

Explain the 'First-In, First-Out' principle and its applications in computer science.

Facilitation TipWhen students Build Queue Class, require them to include comments that name each method’s purpose and where it modifies the queue.

What to look forPose the question: 'Imagine you are designing a system for managing emergency room patient arrivals. Would a standard queue or a priority queue be more appropriate, and why? Consider factors like patient condition and arrival time.'

ApplyAnalyzeEvaluateCreateRelationship SkillsDecision-MakingSelf-Management
Generate Complete Lesson

Activity 03

Collaborative Problem-Solving50 min · Small Groups

Design: Print Job Scheduler

Small groups sketch a queue-based system for managing print requests, listing inputs, operations, and outputs. Code a prototype that processes jobs in FIFO order and handles pauses. Present designs to class for feedback.

Design a system that uses a queue to manage incoming requests.

Facilitation TipFor the Print Job Scheduler, ask groups to present their scheduler’s output for the same input queue to highlight how priority changes the order.

What to look forOn a small slip of paper, have students define 'enqueue' and 'dequeue' in their own words and provide one specific example of where a queue is used in a computer system.

ApplyAnalyzeEvaluateCreateRelationship SkillsDecision-MakingSelf-Management
Generate Complete Lesson

Activity 04

Collaborative Problem-Solving35 min · Whole Class

Comparison: Queue vs Priority

Whole class codes simple queue and priority queue classes side-by-side. Input mixed-priority tasks, run both, and chart output orders. Discuss when each structure fits specific scenarios.

How do priority queues differ from standard queues in real-world scheduling?

Facilitation TipIn the Queue vs Priority comparison, provide a shared set of operations and have students time how long it takes to retrieve each element to quantify the performance difference.

What to look forPresent students with a sequence of enqueue and dequeue operations (e.g., enqueue(A), enqueue(B), dequeue(), enqueue(C), dequeue(), dequeue()). Ask them to write down the state of the queue after each operation and list the elements dequeued in order.

ApplyAnalyzeEvaluateCreateRelationship SkillsDecision-MakingSelf-Management
Generate Complete Lesson

A few notes on teaching this unit

Start with physical simulations to build intuition before coding, because abstract data structures make more sense when tied to familiar experiences like waiting in line. Avoid rushing to implementation; let students verbalize the order of operations first. Research shows that students who act out the process before coding debug their own logic errors more effectively.

By the end, students should confidently implement queue operations and explain why FIFO matters in both code and real life. They should also distinguish queues from other data structures and justify their choices in scheduling scenarios.


Watch Out for These Misconceptions

  • During the Card Queue Line-Up, watch for students attempting to remove cards from the middle or rear, treating the queue like a list.

    Hand each group a deck of cards and ask them to simulate a checkout line. When they try to remove a card from the middle, stop the simulation and ask the group to re-enact the scenario while following FIFO rules, then record why the attempt violated the principle.

  • During the Queue vs Priority comparison, watch for students assuming priority queues follow arrival order when the highest priority arrives last.

    Provide identical sequences of enqueue operations for both queue types. Ask groups to draw the removal order for each, then present their results side by side. Discuss why the priority queue’s output diverged and how real systems like hospital triage use this difference.

  • During Build Queue Class, watch for students conflating queue and stack behavior in their method names or logic.

    Before coding, ask students to sketch both a stack and a queue with arrows showing where elements enter and leave. Require them to label each method in their Queue Class with either "FIFO" or "LIFO" to reinforce the structural difference before implementation.


Methods used in this brief