Arrays Explained – 1D and 2D Arrays (O Level Computer Science 2210 / IGCSE 0478)
What Is an Array?
An array is a data structure used to store multiple values of the same data type under one variable name.
Instead of creating many separate variables, an array allows a program to store and manage related data together.
Example:
Instead of writing:
score1 ← 85
score2 ← 90
score3 ← 78We can use an array:
scores[1] ← 85
scores[2] ← 90
scores[3] ← 78Here, scores is the array name, and each value is accessed using an index number.
Why Arrays Are Used
Arrays help programs:
Store large amounts of related data
Organize information efficiently
Simplify program code
Process data using loops
Arrays are commonly used when working with lists of data such as:
Student marks
Temperature readings
Product prices
One-Dimensional Arrays (1D Arrays)
A one-dimensional array stores data in a single row or list.
Example:
marks[1] ← 75
marks[2] ← 80
marks[3] ← 65
marks[4] ← 90This array stores four student marks.
We can access each value using its index position.
Example:
OUTPUT marks[2]Output: 80
Using Arrays with Loops
Arrays are often used together with loops.
Example pseudocode:
FOR i ← 1 TO 5
INPUT marks[i]
NEXT iThis loop allows the program to input multiple values into the array efficiently.
Two-Dimensional Arrays (2D Arrays)
A two-dimensional array stores data in rows and columns, similar to a table.
Example:
marks[1,1] ← 75
marks[1,2] ← 80
marks[2,1] ← 65
marks[2,2] ← 90This structure is useful when storing table-like data, such as:
Student marks for multiple subjects
Game boards
Matrices
Example of a 2D Array Table
StudentMathScienceStudent 17580Student 26590
Each value can be accessed using two indices: row and column.
Advantages of Arrays
Arrays provide several benefits:
✅ Efficient storage of related data
✅ Easy data processing with loops
✅ Organized data structure
✅ Simplifies program design
Because of these advantages, arrays are widely used in programming and data processing.
Exam Tip (2210 / 0478)
Students are commonly asked to:
Define arrays
Explain 1D and 2D arrays
Write pseudocode using arrays and loops
A common exam question is:
Explain one advantage of using arrays in programming.
Practice Question
Explain one advantage of using arrays instead of multiple variables.
Answer
Arrays allow programs to store many related values using a single variable name, making programs easier to manage.
Study Computer Science with IVY Online
Preparing for Cambridge O Level Computer Science (2210) or IGCSE Computer Science (0478) requires strong programming concepts and exam-focused practice.
With the IVY Online App, students can access:
Complete syllabus coverage
Interactive concept explanations
Programming practice
Past paper solutions
📱 Download the IVY Online App and start preparing smarter for Computer Science exams.

