An array stores many values of the same type under one name, reached by an index number. This lesson explains why an array beats a pile of separate variables, how to declare and index 1D and 2D arrays the Cambridge way, and how to walk through an array with a FOR loop.
1. After these statements, what value is stored in Scores[2]? Scores[1] <- 40 Scores[2] <- 55 Scores[3] <- 70
2. In an array declared as ARRAY[1:3, 1:4] OF INTEGER, what does Grid[2,3] refer to?
3. What value is output by this code? DECLARE nums : ARRAY[1:4] OF INTEGER nums[1] <- 2 nums[2] <- 4 nums[3] <- 6 nums[4] <- 8 total <- 0 FOR i <- 1 TO 4 total <- total + nums[i] NEXT i OUTPUT total
4. What is the main advantage of using an array instead of 30 separate variables to hold 30 marks?
Practise exam-style questions on this
Type your answer, see your mark against the mark scheme in seconds. Free, 5 a day.
Start practising →
Teaching this topic?
Mark your whole class's answers and see who's stuck, for £19 a month.
See the class plan →
Free revision content. Multiple-choice answers are marked instantly. Written answers are marked by AI on /free-mark. Independent, not endorsed by Cambridge International.