Skip to main content
EnglandComputer ScienceSyllabus dot point

What is an array, and how do you store and process many values with one?

Arrays as a data structure: declaring and using one-dimensional arrays, accessing elements by index, and iterating through an array with a loop, with awareness of two-dimensional arrays.

An Eduqas GCSE Computer Science answer on arrays as a data structure: declaring and using one-dimensional arrays, accessing elements by index, iterating through an array with a loop, and awareness of two-dimensional arrays.

Generated by Claude Opus 4.810 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. What an array is
  3. Accessing and changing elements
  4. Iterating through an array
  5. Two-dimensional arrays
  6. Try this

What this dot point is asking

Eduqas wants you to explain what an array is, declare and use a one-dimensional array, access elements by index, and iterate through an array with a loop, with awareness of two-dimensional arrays. Writing a short algorithm that fills and processes an array (such as finding the largest value) is a common Component 1 and Component 2 task.

What an array is

Accessing and changing elements

scores = [0, 0, 0, 0, 0]
scores[0] = 88
scores[1] = 72
output scores[0]      // outputs 88

Iterating through an array

Two-dimensional arrays

A two-dimensional array stores values in a grid of rows and columns, useful for tables such as a class's marks across several tests. You access an element with two indexes, one for the row and one for the column, for example grid[1][3]. At GCSE the main expectation is one-dimensional arrays, with awareness that two-dimensional arrays exist for grid-like data.

Try this

Q1. State what an array is. [1 mark]

  • Cue. A data structure that stores many values of the same data type under one identifier, each accessed by an index.

Q2. In an array data indexed from 0, state which element data[3] is. [1 mark]

  • Cue. The fourth element (because indexing starts at 0).

Q3. State one advantage of an array over using separate variables for a list. [1 mark]

  • Cue. A loop can process every element by index, so the code is shorter and scales to any size.

Exam-style practice questions

Practice questions written in the style of WJEC Eduqas exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

Eduqas Component 1, 20224 marksExplain what an array is and why it is more efficient than using separate variables to store a list of 30 test scores.
Show worked answer →

What an array is (up to 2 marks): a data structure that stores many values of the same data type under one identifier, each accessed by an index (position) number.

Why more efficient (up to 2 marks): instead of declaring 30 separate variables (score1, score2 and so on), you declare one array and use a loop to process all 30 by index, so the code is much shorter, and the size can be handled with a single loop rather than 30 lines.

Markers reward "same type, one name, accessed by index" and the point that a loop can process the whole array, which separate variables cannot.

Eduqas Component 1, 20235 marksWrite an algorithm that stores five numbers in an array, then outputs the largest of them.
Show worked answer →

Read five numbers into an array, set the largest to the first element, then loop through comparing.

Read into numbers[0] to numbers[4]; largest = numbers[0]; for i = 1 to 4; if numbers[i] > largest then largest = numbers[i] endif; next i; output largest.

Marks: declaring/filling the array (1), initialising largest to the first element (1), looping through the rest (1), the comparison and update (1), outputting the largest (1).

Markers reward initialising from the first element and looping from index 1. Starting largest at 0 fails if all numbers are negative.

Related dot points

Sources & how we know this