O Level · Computer Science 0478

Arrays

Revise Arrays for Computer Science 0478 (O Level) — revision notes and instant AI marking.

📖 Revision notes · preview
  CIE IGCSE Computer Science

Arrays: The Complete Revision Guide

The big idea: An array is a single named box divided into fixed, ordered compartments that all hold the same type of thing — so instead of naming every value separately, you find any value by its position.

Summary — What This Chapter Covers

  • What an array actually is, and why it exists (fixed-size, single data type, ordered).
  • The index war: Python starts counting at 0, CIE pseudocode starts counting at 1.
  • How to declare, access, and modify elements in a 1D array — in both pseudocode and Python.
  • Using len() / a length variable to find how many elements are in an array.
  • Iterating through a 1D array with a FOR...NEXT loop.
  • 2D arrays — thinking of them as a grid with rows and columns, and how to navigate row-first, then column.
  • Declaring, accessing, and modifying elements in a 2D array — pseudocode uses [row, col], Python uses [row][col].
  • Nested FOR...NEXT loops to iterate through every cell of a 2D array.

1. What Is an Array?

Imagine you need to store the test scores of 5 students. You create five separate variables — score1, score2, score3, score4, score5 — but that's clunky, and it falls apart completely if you have 500 students instead of 5. You'd need 500 variable names, and looping through them would be impossible because you can't easily say "give me variable number 347" in a loop.

An array solves this. Think of it like a strip of numbered pigeonholes bolted to a wall. The whole strip has one name (say, scores), and each pigeonhole has a position number. To get a value out, you don't need a new variable name — you just say "give me the value in pigeonhole 3."

Formally, an array is defined by three properties, and all three matter for exam answers:

Definition to memorise word-for-word An array is an ordered, static (fixed-size) set of elements stored in a single, named block of memory, where every element must be the same data type.
  • Ordered — every element has a fixed position (an index), so the array always keeps the same sequence unless you explicitly change it.
  • Static / fixed-size — once you declare an array to hold, say, 5 elements, it always has exactly 5 slots. You can't stretch it to hold a 6th value without creating a new array. (This is different from a Python , which can grow — but for IGCSE purposes, arrays are treated as fixed-size.)
  • Single data type — an array of integers can only hold integers. You can't mix a string into an array of numbers.
Visualising a 1D array

Here's the array ["B","E","A","D","S"] drawn out — notice this uses zero-indexing (the Python/most-languages convention):

0
B
1
E
2
A
3
D
4
S

Array length is 5 · First element is at index 0 · The 4th element ("D") sits at index 3

The single most important rule in this whole chapter

In CIE pseudocode, indexes start at 1. In Python, indexes start at 0. This is the #1 thing that trips students up in exams — because you'll be shown pseudocode and Python for the exact same array, and the same real-world position (e.g. "the 4th element") will be written as [4] in pseudocode but [3] in Python.

Practice Question 1

An array called fruits stores 6 values. In CIE pseudocode, what index would you use to access the very last element? What about in Python?

Practice Question 2
🔓 Read the full Arrays note → You're seeing the preview · sign in to read it all
Also in the full note
  • 2. Creating, Accessing & Modifying a 1D Array
  • 3. 2-Dimensional Arrays
  • 4. Iterating Through a 2D Array
  • What to Memorise
  • Concepts Checklist
  • Exam Tips
What's inside
📖 Revision notes 🎯 Learn mode ✦ AI flashcards ✓ Instant AI marking 🧊 3D explorers 🧪 Experiments & simulations 📈 Progress tracking
📄 Practise Arrays with Computer Science 0478 past papers Every paper with its mark scheme — answer online, marked instantly. Open →

Read the full Arrays notes free

That's the preview — create a free account to read the rest, plus flashcards and practice questions with instant AI marking. No credit card.

Unlock the full notes free →

More Computer Science topics