NEW
Font size
S
M
L
XL
Worksheets10.4 Python Lists
Total questions: 14
Worksheet time: 8mins
Name
Class
Date
1.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
2.
Is this the correct code for a list?
register = {"Sam", "Pheobe", Georgia", Richard"}
a)
Yes
b)
No
3.
What is the index of “grape” in the list
[“apple”, “grape”, “orange”, “watermelon”]?
a)
0
b)
1
c)
2
d)
3
4.
What is the output of program below?
bicycles = ['trek', 'cannondale', 'redline', 'specialized']
print(bicycles[-1])
a)
trek
b)
cannondale
c)
redline
d)
specialized
5.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
6.
What is the position of the name "Robert" in the following list:
a)
0
b)
1
c)
2
d)
3
7.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
8.
Each item in a list has an "address" or index. The first index in a Python list is what?
a)
0
b)
1
c)
a
d)
A
9.
In a list called "players" if you wanted to delete the item with an index of 3 which of the following examples of code would be correct?
a)
players.pop[3]
b)
players.delete(3)
c)
players.remove(3)
d)
players.pop(3)
10.
If you want to create an empty list called colours, which of the following pieces of code is correct?
a)
colours = [ ]
b)
colours = ( )
c)
colours = { }
d)
colors = [ ]
11.
What output will this code produce?
a)
Exeter
b)
4
c)
6
d)
city
12.
What output will this code produce?
a)
red
b)
['blue', 'green', 'red']
c)
['red', 'green', 'blue']
d)
error
13.
What output will this code produce?
a)
['blue', 'green', 'red', 'yellow']
b)
['blue', 'red', 'yellow']
c)
['yellow', 'red', 'green']
d)
['yellow', 'red', 'blue']
14.
What will line 3 OUTPUT?
a)
3
b)
2
c)
TRUE
d)
FALSE
Reset
