Arrays (CIE IGCSE Computer Science)

Revision Note

Test Yourself
Becci Peters

Expertise

Computer Science

1D Arrays

A one-dimensional (1D) array is a collection of items of the same data type.

  • To declare an array in pseudocode, use the syntax:
    DECLARE arrayName[n] OF dataType
  • To declare an array in Python, use the syntax:
    array_name = [0] * n
  • In Java, use the syntax:
    dataType[] arrayName = new dataType[n];
  • In Visual Basic, use the syntax:
    Dim arrayName(n) As dataType

To access elements in a 1D array, use the index, which can start at 0 or 1.

2D Arrays

A two-dimensional (2D) array is an array of arrays, creating a grid-like structure.

  • To declare a 2D array in pseudocode using the syntax:
    DECLARE arrayName[n][m] OF dataType
  • In Python, use the syntax:
    array_name = [[0] * m for _ in range(n)]
  • In Java, use the syntax:
    dataType[][] arrayName = new dataType[n][m];
  • In Visual Basic, use the syntax:
    Dim arrayName(n, m) As dataType

To access elements in a 2D array, use two indices: the row index and the column index.

The syntax for accessing elements is similar across languages, using square brackets:

  • [i] for 1D arrays,
  • and [i][j] for 2D arrays.

You've read 0 of your 0 free revision notes

Get unlimited access

to absolutely everything:

  • Downloadable PDFs
  • Unlimited Revision Notes
  • Topic Questions
  • Past Papers
  • Model Answers
  • Videos (Maths and Science)

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

Becci Peters

Author: Becci Peters

Becci has been a passionate Computing teacher for over 9 years, teaching Computing across the UK helping to engage, interest and develop confidence in the subject at all levels. Working as a Head of Department and then as an educational consultant, Becci has advised schools in England, where her role was to support and coach teachers to improve Computing teaching for all. Becci is also a senior examiner for multiple exam boards covering GCSE & A-level. She has worked as a lecturer at a university, lecturing trainee teachers for Computing.