Revision Notes
Cambridge IGCSE Computer Science (0478): Arrays – Revision Notes
Revision notes for Cambridge IGCSE Computer Science 0478 section 8.2: array declaration, indexes, loops over 1D and 2D arrays, and common array algorithms.
- Subject
- Computer Science
- Level
- IGCSE
- Topic
- Topic 8: Programming
- Author
- Marlbridge Academic Team
- Updated
- Reviewed by
- Harris Khan (what this means)
Aligned to Cambridge IGCSE Computer Science (0478), 2026-2028. Official specification .
Syllabus page (what it covers and how it is assessed): Cambridge IGCSE Computer Science.
Syllabus points this page covers
0478
- 8.2 Arrays
This page covers 1 of the 3 subtopics in topic 8, Programming.
Found an error? Report a correction.
Need help with this topic? Request a free trial class for IGCSE Computer Science (0478).
Condensed notes for syllabus section 8.2, Arrays: 1D and 2D arrays, indexes and loops.
Four facts to start with
- An array stores a fixed number of elements of the same data type under one name.
- Each element is found using an index.
- A 1D array needs one index; a 2D array needs two.
- Loops, including nested loops for 2D arrays, read and write arrays.
Key terms
| Term | Definition |
|---|---|
| Array | Data structure holding a fixed number of elements of the same type |
| Element | One item in an array |
| Index | Number that gives the position of an element |
| Lower bound / upper bound | First and last index |
| 1D array | List with one index |
| 2D array | Table with row and column indexes |
| Nested loop | Loop inside another loop |
| Linear search | Checking each element in turn until the value is found or the end is reached |
Declaring and using arrays
| Task | Pseudocode |
|---|---|
| 1D declaration | DECLARE Names : ARRAY[1:30] OF STRING |
| 2D declaration | DECLARE Grid : ARRAY[1:3, 1:3] OF CHAR |
| Assign | Names[1] ← "Ali", Grid[2, 3] ← 'X' |
| Variable index | Names[Index + 1] ← Names[Index] |
| Number of elements | upper − lower + 1 (1D); rows × columns (2D) |
Standard loops
Write a 1D array: FOR Index ← 1 TO 5 then INPUT Marks[Index] then NEXT Index.
Total a 1D array: set Total ← 0, then add Marks[Index] in the loop.
2D array: outer loop for rows, inner loop for columns.
FOR Row ← 1 TO 3
FOR Column ← 1 TO 4
Table[Row, Column] ← 0
NEXT Column
NEXT Row
Worked example: trace of a loop
Values[1] ← 4 Values[2] ← 7 Values[3] ← 2 Values[4] ← 9
Count ← 0
FOR Index ← 1 TO 4
IF Values[Index] > 5
THEN
Count ← Count + 1
ENDIF
NEXT Index
| Index | Values[Index] | Count |
|---|---|---|
| 1 | 4 | 0 |
| 2 | 7 | 1 |
| 3 | 2 | 1 |
| 4 | 9 | 2 |
Count finishes as 2.
Worked example: maximum
Start Highest ← Marks[1], loop from 2 to the upper bound and replace Highest whenever Marks[Index] is bigger. For 12, 18, 9, 20, 15 the answer is 20.
Linear search outline
- Set
Found ← FALSEandIndex ← 1. - Repeat while
Indexis within the array andFoundis FALSE. - If
Marks[Index]equals the search value, setFound ← TRUE; otherwise add 1 toIndex. - Output the position or “Not found”.
2D array example
| Col 1 | Col 2 | Col 3 | |
|---|---|---|---|
| Row 1 | 3 | 5 | 1 |
| Row 2 | 8 | 2 | 6 |
Table[2, 3] is 6. Total of row 1 is 9. Total of row 2 is 16. Total of all is 25.
Zero or one
The first index may be 0 or 1. State it in the declaration. A 1D array ARRAY[0:4] has 5 elements, the same as ARRAY[1:5].
Which array to use
| Data | Structure |
|---|---|
| A list of 30 names | 1D array of STRING |
| Marks for 3 classes of 4 students | 2D array of INTEGER |
| Names and matching scores | Two 1D arrays with the same index |
| A game board | 2D array of CHAR |
Common patterns at a glance
| Task | Idea |
|---|---|
| Total | Start at 0; add Array[Index] in a loop |
| Average | Total divided by number of elements |
| Highest | Start with the first element; replace when a bigger one is found |
| Count | Add 1 when the condition is true |
| Search | Compare each element; stop when found |
| Reverse output | Loop from the upper bound down to the lower bound with STEP -1 |
Exam traps
- Index out of range. Check the bounds.
- Row and column swapped.
- Total not reset in the right place for 2D arrays.
- Loop limits wrong.
1 TO 5for five elements. - Mixed data types. All elements are the same type.
- Using the array name alone when one element is needed.
Self-test
- What is an array?
- How many elements are in
ARRAY[1:8]? - How many elements are in
ARRAY[1:4, 1:5]? - What does
Marks[3]mean? - Why use a variable as an index?
- Which loop type is normally used to read an array of known size?
- How are two loops used for a 2D array?
- What value is assigned in
Grid[2, 3] ← 'X', and where? - What is a linear search?
- Why is a total reset inside the outer loop in a row-total program?
Answers
- A data structure that holds a fixed number of elements of the same type under one name.
-
-
- The element at index 3 of Marks.
- So a loop can visit every element with the same code.
- A count-controlled (FOR) loop.
- The outer loop moves through the rows and the inner loop through the columns.
- The character
Xis put in row 2, column 3. - Checking each element in turn until the value is found or the end is reached.
- So each row’s total starts from 0.
Command words to expect
| Command word | What to write |
|---|---|
| State, Give, Identify | A short answer with no explanation |
| Define | A precise meaning |
| Describe | The main points or characteristics, or the steps in order |
| Explain | A reason or “how and why”, supported with evidence from the question |
| Compare | Similarities and differences, naming both sides every time |
| Suggest | A sensible proposal that applies your knowledge to the situation given |
| Evaluate | A judgement based on advantages and disadvantages, ending with a conclusion |
Read the full explanations in the Arrays study guide, then try the Arrays practice questions.
Official syllabus
Cambridge IGCSE Computer Science (0478) syllabus for 2026, 2027 and 2028, section 8.2: official syllabus PDF.
Related resources
-
Study guides
Cambridge IGCSE Computer Science (0478): File handling
Study guide to Cambridge IGCSE Computer Science 0478 section 8.3: why programs store data in files, and how to open, read, write and close a file using the syllabus pseudocode.
Computer Science · Cambridge · IGCSE
Read guide -
Practice questions
Cambridge IGCSE Computer Science (0478): File handling – Practice Questions
Original questions with full answers on Cambridge IGCSE Computer Science 0478 section 8.3: purpose of files, file modes, and reading and writing data in pseudocode.
Computer Science · Cambridge · IGCSE
Try questions -
Revision notes
Cambridge IGCSE Computer Science (0478): File handling – Revision Notes
Revision notes for Cambridge IGCSE Computer Science 0478 section 8.3: OPENFILE, READFILE, WRITEFILE and CLOSEFILE, file modes and common file patterns.
Computer Science · Cambridge · IGCSE
Revise topic
Get free revision emails (optional)
Occasional emails with practice questions, worked explanations and links to free resources for the qualification and subjects you choose. No spam, and you can unsubscribe from any email. The free tools on this site never need an email.