Which term describes a data structure that stores values in rows and columns, where each value can be found using two indexes?
Two-dimensional array
What is meant by a row in a two-dimensional array?
One inner list of the array, whose elements are all found using the same first index
Which term describes the elements that all sit at the same position in every inner list of a two-dimensional array, found by keeping the second index the same?
A column
What is meant by a list of lists in Python?
A structure where each item in the outer list is itself a list
What is meant by a nested loop?
One loop placed inside another, so that every element of a two-dimensional array can be visited
Which term describes a single value stored at one position in a two-dimensional array?
An element
A 2D array seatPlan holds 5 rows of seats with 8 seats in each row. What does len(seatPlan) give?
The number of rows in the 2D array
A 2D array marks stores marks for pupils. Each row is a pupil, each column is a test. Row 1 is [45, 60, 72, 50]. What is marks[1][2]?
72
A 2D array grid has 5 rows and 4 columns with indexes starting at 0. Which element is in the last row and last column?
grid[4][3]
A 2D array grid has 6 rows and 3 columns. What does len(grid[0]) return?
3
A 2D array stores exam marks for a class. What is true about the elements it can store?
All elements must be the same data type
A 2D array scores has rows for students and columns for tests. Row 2 is [10, 20, 30, 40]. What is the total for student 2?
100
A 2D array scores has rows for students and columns for tests. Column 1 contains 5, 10, 15, 20. What is the total for test 1?
50
A 2D array has 4 rows and 5 columns. Using nested loops to visit every element once, how many times does the inner loop body run?
20
A program uses nested loops to find the highest value in a 2D array and report its position. What must the program store as well as the highest value?
The row index and the column index
A program builds a 3 by 3 grid of dashes row by row in Python. What should be appended to the grid after each row is filled?
The completed row as a list
A 2D array Board holds a chess board, where each row and each column is a square. Which statement puts a pawn in row 1, column 0?
Board[1][0] = 'Pawn'
A 2D array scores holds marks for 2 pupils in 3 tests, with one row per pupil. The rows are [12, 8, 10] and [6, 14, 4]. What is the mean mark of pupil 1?
8
A 2D array grid holds 4 rows and 3 columns. A program runs print(grid[2]). What is printed?
All three values in row 2
A program must search a 2D array grid for the lowest value. What should the variable that holds the lowest value be set to before the loops start?
The value already stored in grid[0][0]
We use cookies to enhance your experience. You can manage your preferences or learn more in our Cookie Policy.