NEW
Font size
WorksheetsMultidimensional list and tuples 2025
Total questions: 44
Worksheet time: 44mins
Pam is working on a Python project, and she discovered that both tuples and lists in her code can contain a heterogeneous sequence of elements. Is this statement correct?
True
False
What will print when this code executes?
<class 'tuple'>
<class 'list'>
<class 'set'>
<class 'dict'>
What will print when this code executes?
<class 'tuple'>
<class 'list'>
<class 'set'>
<class 'dict'>
<class 'int'>
What will print when this code executes?
<class 'tuple'>
<class 'list'>
<class 'set'>
<class 'dict'>
<class 'int'>
What will print when this code executes?
<class 'tuple'>
<class 'list'>
<class 'set'>
<class 'dict'>
<class 'int'>
What will print when this code executes?
<class 'tuple'>
<class 'list'>
<class 'set'>
<class 'dict'>
What will print when this code executes?
<class 'tuple'>
<class 'list'>
<class 'set'>
<class 'dict'>
What will print when this code executes?
Donatello
Michelangelo
Raphael
Leonardo
What will print when this code executes?
Donatello
Michelangelo
Raphael
Leonardo
Regarding the properties of lists and tuples, which statement is accurate?
Both lists and tuples can be modified after creation.
Only lists can be modified after creation, tuples cannot.
Both lists and tuples cannot be modified after creation.
Only tuples can be modified after creation, lists cannot.
What will print when this code executes?
Donatello
Michelangelo
Raphael
Leonardo
What will print when this code executes?
Donatello
Michelangelo
Raphael
Leonardo
What will print when this code executes?
Donatello
Michelangelo
Raphael
Leonardo
What will print when this code executes?
Donatello
Michelangelo
Raphael
Leonardo
What will print when this code executes?
(1, 2, 3)
(4, 5, 6)
(7, 8, 9)
(10, 11, 12)
0
Tuples in Python are mutable
False
True
What will print when this code executes?
(1, 2, 3)
(4, 5, 6)
(7, 8, 9)
(10, 11, 12)
-2
Which of the following statements correctly describes the mutability of lists and tuples in Python?
Lists are immutable, while tuples are mutable.
Lists are mutable, while tuples are immutable.
Both lists and tuples are mutable.
Neither lists nor tuples are mutable.
What will print when this code executes?
3
5
6
9
11
What will print when this code executes?
3
6
8
10
9
What will print when this code executes?
1
4
7
6
9
What will print when this code executes?
3
4
7
10
9
What will print when this code executes?
[4, 5, 6]
[7, 8, 9]
7
2
[10, 11, 12]
What will print when this code executes?
[4, 5, 6]
[7, 8, 9]
7
2
[10, 11, 12]
What will print when this code executes?
[4, 5, 6]
4
7
2
10
What will print when this code executes?
3
cat
12
turtle
15
What will be the output for the program above?
<class 'tuple'>
<class 'list'>
<class 'set'>
<class 'dict'>
What will be the output for the program above?
<class 'tuple'>
<class 'list'>
<class 'set'>
<class 'dict'>
What would this code show on the screen?
7
6
5
4
An error
What is the correct order for accessing elements in a 2D array?
[row][column]
[column][row]
Which of the following code snippets will print 20 to the screen, given this list:
my_list=[[2,4,6,8],[1,3,5,7],[0,10,20,30]]
print(my_list[2][2])
print(my_list[1][3])
print(my_list[0][2])
print(my_list[2][1])
What will be the output if the programmer wrote the command:
print(my_data[1][1][1])
2
11
22
8
Which of the following code snippets will print 7 to the screen, given this list:
my_list=[[2,4,6,8],[1,3,5,7],[0,10,20,30]]
print(my_list[1][3])
print(my_list[0][1])
print(my_list[2][0])
print(my_list[1][2])
Which would be the correct code to access number 10
list_2d[3][4]
list_2d= [2,3]
list_2d[2][3]
list_2d(0,0)
Which would be the correct code to access number 4
list_2d[1][3]
list_2d= [1,2]
list_2d[1][1]
list_2d(1,3)
What will print when this code executes?
fish
cat
dog
turtle
hamster
Which of the list below has the dimensions of 3 X 2 X 3?
Which of the list below has the dimensions of 9 X 2?
Which of the list below has the dimensions of 3 X 3 X 2?
Which of the list below has the dimensions of 3 X 2 X 2?
Which of the list below has the dimensions of 3 X 4 ?
Which of the list below has the dimensions of 4 X 3 ?
Which of the list below has the dimensions of 2 X 6 ?
Which of the list below has the dimensions of 6 X 2 ?
