Use the technical terms associated with arrays

Published by Patrick Mutisya · 14 days ago

Arrays – A‑Level Computer Science 9618

10.2 Arrays – Technical Terminology

What is an Array?

An array is a collection of elements of the same data type stored in contiguous memory locations and accessed by a numeric index (or subscript).

Key Terms

  • Element – a single value stored in an array.
  • Index / Subscript – the integer used to locate an element. In most A‑Level languages the first element has index 0 (zero‑based indexing).
  • Bounds – the lowest and highest valid indices of an array (lower bound and upper bound).
  • Length / Size – the total number of elements an array can hold.
  • Dimension – the number of indices required to access an element (1‑D, 2‑D, …).
  • Static Array – an array whose size is fixed at compile time.
  • Dynamic Array – an array whose size can be created or altered at run time (e.g., using new in Java).
  • Row‑major order – storage order where rows are stored contiguously (used by Java, C, Python).
  • Column‑major order – storage order where columns are stored contiguously (used by Fortran).
  • Declaration – the statement that defines an array’s type and size.
  • Initialization – assigning values to an array at the point of declaration or later.
  • Access / Retrieval – reading the value of an element using its index.
  • Assignment / Update – writing a new value to an element using its index.
  • Iteration – repeatedly processing elements, typically with a for loop.
  • Bounds checking – runtime verification that an index lies within the array’s bounds.
  • Out‑of‑bounds error – an exception or undefined behaviour caused by using an illegal index.

Array Declaration and Initialization Examples

Java (static, zero‑based):

int[] scores = new int[5]; // declaration, length 5

int[] ages = {12, 15, 17, 19, 21}; // declaration + initialization

Python (dynamic, zero‑based):

scores = [0] * 5 # list of length 5

ages = [12, 15, 17, 19, 21]

Address Calculation (One‑Dimensional)

When an array is stored in contiguous memory, the address of element i can be computed as:

\$\$

\text{address}(i) = \text{baseAddress} + i \times \text{elementSize}

\$\$

where i is the zero‑based index.

Address Calculation (Two‑Dimensional, Row‑major)

For an array A with R rows and C columns, the address of element A[i][j] is:

\$\$

\text{address}(i,j) = \text{baseAddress} + \bigl(i \times C + j\bigr) \times \text{elementSize}

\$\$

In column‑major order the formula swaps the roles of i and j.

Common Operations

  1. Declare an array.
  2. Initialize the array (explicit values or default).
  3. Access an element: value = array[index];
  4. Update an element: array[index] = new \cdot alue;
  5. Iterate using a loop, ensuring 0 ≤ index < length.

Summary Table of Terms

TermDefinition
ArrayOrdered collection of same‑type elements stored contiguously.
ElementIndividual value stored at a particular index.
Index / SubscriptInteger used to locate an element; first index is usually 0.
BoundsLowest and highest valid indices (0 and length‑1 for zero‑based arrays).
Length / SizeNumber of elements an array can contain.
DimensionNumber of indices required (1‑D, 2‑D, …).
Static ArraySize fixed at compile time.
Dynamic ArraySize determined or changed at run time.
Row‑major orderRows stored consecutively in memory.
Column‑major orderColumns stored consecutively in memory.
Bounds checkingRuntime test that an index is within valid limits.
Out‑of‑bounds errorException or undefined behaviour caused by an illegal index.

Suggested Diagram

Suggested diagram: Visual representation of a one‑dimensional array showing indices 0 … n‑1 and contiguous memory cells.