Lesson 4.2.1.2
4.2.1.2 Single- and multi-dimensional arrays Quiz: AQA Computer Science, Unit 2
20 questions
In partnership with Revision Ninja
Lesson 4.2.1.2, Single- and multi-dimensional arrays: 20 multiple choice questions for the AQA Computer Science (7517), Unit 2: Fundamentals of data structures, written with Revision Ninja.
Host it live on the board and students join with a game code on their own devices, or revise alone with Free Play. The answers are revealed in the game.
The 20 questions
-
What is a one-dimensional array?
- A list of files on a disk, with each file stored at a numbered position in the directory
- A variable holding a memory address, which points to the first element of a block in memory
- A record with fields of different types, which groups related values under one shared name
- A set of elements of the same data type indexed by a single integer
-
A one-dimensional array is a useful way to represent which mathematical object?
- A graph
- A binary tree
- A vector
- A hash function
-
A two-dimensional array is a useful way to represent which mathematical object?
- A queue
- A dictionary
- A stack
- A matrix
-
An array is declared with indexes 0 to 9. How many elements does it hold?
- 10
- 9
- 0
- 11
-
A 3 by 4 array has 3 rows and 4 columns. How many elements does it hold?
- 12
- 3
- 7
- 34
-
What does an n-dimensional array require to locate an element?
- A tuple of n integers as the index
- No index at all, because the element is found by scanning the whole array from its start
- A single string key, which is looked up in a table to find the position of the element
- A pointer to a record, which holds the address of the start of the array in memory
-
An array scores holds the values 4, 7, 2 and 9 at indexes 0 to 3. What is scores[2]?
- 9
- 4
- 7
- 2
-
A 2D array grid has rows 0 to 2 and columns 0 to 3. What is the value of grid[1][2] if row 1 is 5, 6, 7, 8?
- 6
- 5
- 7
- 8
-
A loop sums all 10 elements of a one-dimensional array. How many additions does it perform?
- 1
- 9
- 10
- 11
-
An array holds the values 3, 8 and 5 at indexes 0 to 2. What is the largest value in the array?
- 5
- 3
- 8
- 16
-
Why must all the elements of an array have the same data type?
- So that each element occupies the same amount of storage and can be accessed by index
- So the array can be saved as a text file only, since binary data cannot be stored in arrays
- Because records must be stored in arrays, so every element is a record with the same fields
- Because arrays cannot store numbers, so each element must hold text in a fixed format
-
A program uses a one-dimensional array to store the 12 months' sales figures. Which index is used for January if indexing starts at 0?
- 11
- 0
- 1
- 12
-
A 2D array representing a 5 by 5 board needs what index to reach the centre cell if indexing starts at 0?
- [1][1]
- [4][4]
- [5][5]
- [2][2]
-
Which statement describes a multi-dimensional array correctly?
- It can only have one index, which is why it is used only for lists of single values
- It is the same as a linked list, with each element pointing to the next element in order
- It holds elements of different types in one index, so a single position stores many values
- It holds elements indexed by several integers, such as row and column
-
A program stores a timetable as a 5 by 6 array, with 5 days and 6 periods. What does each element represent?
- A student name only, which is recorded against the day and period of each class taken
- A lesson for a particular day and period
- A day of the week only, with the period stored separately in a second array of the same size
- A constant value for the school, which is the same for every day and every period of the week
-
A one-dimensional array of 100 elements is used where indexes run 0 to 99. What is the index of the last element?
- 99
- 100
- 1
- 98
-
What is an advantage of arrays for storing a list of similar values?
- Arrays store values in the order of their data types, grouping all integers before all text
- Arrays automatically sort their values, so the largest value is always found at index zero
- Elements can be accessed directly by index without searching from the start
- Arrays cannot be changed once created, so the values are protected from later accidental change
-
Why is an array sometimes described as equivalent to other structures in some languages?
- Arrays and trees store data in the same way, with each value placed in a node of a binary tree
- Arrays are always the same as hash tables, so keys and values are both stored in each slot
- Many languages offer lists or other indexed collections that do the same job
- Arrays and files are identical, with each element stored as one line of a text file on disk
-
A program reads the array index for an element from the user. Why must the index be checked?
- An index outside the array bounds causes an error or accesses the wrong data
- Indexes must always be negative, so the program must reject every positive value entered
- The check is not needed for arrays, because the language rejects any index that is out of range
- Indexes can only be strings, so any number typed by the user must be converted to text first
-
A program stores a 3 by 3 grid in a two-dimensional array indexed from 0. Which index pair locates the middle value?
- [1][1]
- [0][1]
- [2][2]
- [3][3]
Related quizzes
- Data structures and abstract data types Quiz · 4.2.1.1 · 20 questions
- Reading and writing text and binary files Quiz · 4.2.1.3 · 20 questions
- Linear, circular and priority queues Quiz · 4.2.2.1 · 20 questions
- Stack operations Quiz · 4.2.3.1 · 20 questions
- Graphs: weighted, directed and adjacency representations Quiz · 4.2.4.1 · 20 questions
- Trees and binary trees Quiz · 4.2.5.1 · 20 questions
- Hash tables, hashing and collisions Quiz · 4.2.6.1 · 20 questions
- Dictionaries and key-value pairs Quiz · 4.2.7.1 · 20 questions
- Vectors and vector operations Quiz · 4.2.8.1 · 20 questions
- Data types Quiz · 4.1.1.1 · 20 questions