When writing programs, it is useful to use arrays and lists as they simplify programs by storing related data under one name.
What is a data structure?
A list of variables
A list of variables and strings
A facility that holds more than one value
What is an array?
A list of strings
A series of memory locations, each with the same name, that hold related data
Why are arrays used?
Arrays store multiple data values under one name, reducing the complexity of our program
Arrays store more data than if we were using variables
Arrays store more data than if we were using strings
In an array, what is an element?
The smallest number an array can hold
The biggest number an array can hold
An element is one value in an array
How many elements would the array 'student_marks(10)' hold?
In the array 'numbers(6, 10, 7, 12, 9, 2)', what is the value of element numbers(4)?
In the array 'colours("Purple", "Blue", "Red", "Green", "Yellow")', what is the value of the element colours(3)?
In the array 'names("John", "Ali", "Sarah")', what is the value of element names(2)?
What is the difference between an array and a list?
An array holds numbers, whereas a list holds strings
An array can only hold data of the same data type, whereas lists can hold values of different data types
An array holds both numbers and strings, whereas a list only holds numbers
When creating the array 'scores(9)', what does the '9' in brackets represent?
The number of elements the array can hold
The largest number of digits an element can hold
The largest number of characters an element can hold