Arrays (OCR GCSE Computer Science): Flashcards
📚Flashcards
Practise the cards
14 cards from this deck
ShowHide
Practise the cards
14 cards from this deck
Definition of an array
Definition of an array
A data structure that stores multiple values of the same data type
Array length characteristic
Array length characteristic
Fixed; set at creation and cannot change
Two types of arrays
Two types of arrays
One-dimensional (1D) and two-dimensional (2D)
Structure of a 1D array
Structure of a 1D array
Like a list
Structure of a 2D array
Structure of a 2D array
Like a grid or table with rows and columns
How 2D arrays relate to databases
How 2D arrays relate to databases
Can emulate database tables
Starting index of arrays
Starting index of arrays
0
names[1] where names=['Bob','Alex','Chris']
names[1] where names=['Bob','Alex','Chris']
Alex
len(names) for ['Bob','Alex','Chris']
len(names) for ['Bob','Alex','Chris']
3
sum([5,12,5,7,8])
sum([5,12,5,7,8])
37
matrix[1][1] for [[1,2],[3,4],[5,6]]
matrix[1][1] for [[1,2],[3,4],[5,6]]
4
len(matrix) for [[1,2],[3,4],[5,6]]
len(matrix) for [[1,2],[3,4],[5,6]]
3 (number of rows)
What 2D array rows represent
What 2D array rows represent
Records
What 2D array columns represent
What 2D array columns represent
Fields
