ExamYard Lectures

Arrays: one name, many values

IGCSE Computer Science 0478 · Chapter 8.2, Arrays · 6-minute lecture

The teaching part (1 min) is free to watch. A free account opens the whole lecture: 7 practice questions, 2 real past-paper questions with the answers explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.

What this lecture covers

  1. Thirty variables?
  2. What is an array?
  3. Declare, fill, read
  4. Seven days of data
Read the transcript of the teaching part

Last time

Before we start: last time, in Strings, procedures and functions, you learned these points. Here they are again on one card. Keep them in mind, because today builds on them.

Thirty variables?

A teacher wants to store thirty marks. Thirty separate variables would be a nightmare to write, and impossible to loop through. An array gives them all one name, and a position number for each. Then one loop can process every one of them.

What is an array?

An array is a data structure that holds a fixed number of elements, all of the same data type. All the elements are stored under a single identifier. Each element is found using its index, its position number, which starts at one here. A loop can then process every element, so the code is short and easy to change.

Declare, fill, read

The declaration gives the name, the lower and upper bounds, and the data type. A FOR loop fills each element, with the counter as the index. Temps of three gives the third value directly.

Seven days of data

Here are seven daily temperatures. Day one is twenty-eight, day two thirty-one, day three thirty-three. Day five is thirty-five, the hottest.

How often it comes up

The whole chapter: Arrays.

Chapter 8.2: Arrays

Also for IGCSE Computer Science 0478

Which topics come up most in IGCSE Computer Science 0478 past papers, counted from every paper since 2004: Paper 1 topic frequency, Paper 2 topic frequency.

The topical past-paper books: Paper 1, Paper 2.