🔒

Unlock Pro

Subscribe to access all 59 Edexcel 1CP2 lessons.

£7.99/month
or £59/year
📖 Paper 1 · Topic 2: Computational Thinking
2.4b Lists, Stacks & Queues
Edexcel 1CP2 · GCSE Computer Science · ~10 min read · 🔒 Pro
Notes
──
Video
──
Slides
──
Worksheet
──
Quiz
⭐ Enrichment lesson — this topic is not assessed in the Edexcel 1CP2 GCSE exam. It provides valuable extra knowledge but should not replace revision of the core specification.

Lists

A list is an ordered collection of items that can grow or shrink dynamically. Unlike arrays, lists do not have a fixed size. Items can be added or removed at any position.

  • Items are ordered (maintain insertion order)
  • Can contain duplicates
  • Dynamic size — grows and shrinks as needed
  • Python lists example: fruits = ["apple", "banana", "cherry"]

Stacks

A stack is a last-in, first-out (LIFO) data structure. Items are added and removed from the same end, called the top.

OperationNameDescription
Add item to topPushPlaces new item at the top of the stack
Remove item from topPopRemoves and returns the top item
View top itemPeek/TopReturns top item without removing it
Check if emptyisEmptyReturns True if stack has no items

Stack analogy: a pile of plates. You always add to the top and remove from the top. You can't access the bottom plate without removing those above it first.

Real-world uses of stacks:

  • Browser back button (history is a stack — last visited page is top)
  • Undo/redo function in text editors
  • Call stack — the OS uses a stack to track which function called which
  • Reversing strings or checking brackets match in compilers

Queues

A queue is a first-in, first-out (FIFO) data structure. Items are added at the rear (back) and removed from the front.

OperationNameDescription
Add item to rearEnqueueAdds new item at the back of the queue
Remove item from frontDequeueRemoves and returns the front item
View front itemPeek/FrontReturns front item without removing it
Check if emptyisEmptyReturns True if queue has no items

Queue analogy: a line of people at a bus stop. The first person to join is the first to board the bus (FIFO).

Real-world uses of queues:

  • Print spooler (documents print in order they were sent)
  • CPU task scheduling (process queue)
  • Keyboard input buffer (keystrokes processed in order)
  • Customer service call queues

Comparison Summary

FeatureStackQueue
OrderingLIFO (Last In, First Out)FIFO (First In, First Out)
Add operationPush (to top)Enqueue (to rear)
Remove operationPop (from top)Dequeue (from front)
AccessTop onlyFront and rear
Example useUndo function, browser backPrint queue, CPU scheduler
Exam tip: For stacks remember LIFO and Push/Pop. For queues remember FIFO and Enqueue/Dequeue. Questions often ask you to trace through a sequence of operations — show the state of the stack/queue after each step.
⚠️ Common Mistakes
  • Confusing LIFO and FIFO — Stack = LIFO (pile of plates); Queue = FIFO (bus queue)
  • Using "add" and "remove" instead of the correct terms: Push/Pop for stacks; Enqueue/Dequeue for queues
  • Trying to access the middle of a stack or queue — you can only access the top/front
Video coming soon
Click slide or press arrow keys to navigate

✍️ Worksheet — 2.4b Lists, Stacks & Queues

8 questions · Edexcel-style

Q1What does LIFO stand for, and which data structure uses this principle?[2]
✅ Mark scheme
LIFO stands for Last In, First Out [1]; this is used by a stack — the most recently added item is the first to be removed [1].
Q2A stack contains [5, 10, 15] with 15 at the top. After a Push(20) and then a Pop(), what is the new top of the stack?[2]
✅ Mark scheme
Push(20) → stack is [5,10,15,20], top = 20 [1]; Pop() removes 20, leaving [5,10,15] → new top = 15 [1].
Q3Explain what FIFO means and give a real-world example of a queue in computing.[3]
✅ Mark scheme
FIFO = First In, First Out [1]; the first item added to the queue is the first to be removed [1]; real-world example: print spooler (documents print in the order they were sent), keyboard buffer, CPU scheduling [1].
Q4State the correct term for (a) adding to a stack, (b) removing from a stack, (c) adding to a queue, (d) removing from a queue.[4]
✅ Mark scheme
(a) Push [1]; (b) Pop [1]; (c) Enqueue [1]; (d) Dequeue [1].
Q5Give TWO real-world uses of a stack in computing.[2]
✅ Mark scheme
Any two of: undo/redo function in text editors [1]; browser back button (navigation history) [1]; call stack (function call tracking) [1]; checking matching brackets in compilers [1].
Q6How does a list differ from an array?[2]
✅ Mark scheme
A list is dynamic — it can grow or shrink in size as items are added or removed [1]; whereas an array typically has a fixed size [1]. (Also accept: lists allow insertion/deletion at any position.)
Q7A queue contains [A, B, C] with A at the front. Dequeue() is called, then Enqueue(D) is called. Describe the state of the queue and identify front and rear.[3]
✅ Mark scheme
Dequeue() removes A → queue is [B, C] [1]; Enqueue(D) adds D to the rear → queue is [B, C, D] [1]; front = B, rear = D [1].
Q8Explain why a stack is appropriate for implementing the 'undo' function in a word processor.[3]
✅ Mark scheme
Each action is pushed onto the stack as it is performed [1]; when Undo is pressed, the most recent action is popped from the top [1]; this uses LIFO — the last thing done is the first thing undone, which matches how undo should work [1].
Topic Quiz
Q 1 of 15
You scored
out of 15
Click to reveal definition
🎉
Session complete!
TermDefinition
🎯

Mini Test — Stacks & Queues

10 minutes · Exam-style

← 2.4a Arrays & RecordsTopic 2 · Computational ThinkingNext: 2.5 Subroutines →