wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python-list

Total questions: 21

Worksheet time: 12mins

Name
Class
Date
1.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
2.
What is the position of the name "Robert" in the following list:
a)
0
b)
1
c)
2
d)
3
3.
What does the APPEND procedure do in the following code:
a)
Adds Liverpool to the beginning of the list
b)
Replaces Bristol with Liverpool
c)
Replaces Manchester with Liverpool
d)
Adds Liverpool to the end of the list
4.
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
5.
What output will this code produce?
a)
['France', 'Wales', 'England']
Ireland
b)
['France', 'Ireland', 'England']
c)
['France', 'Ireland', 'Wales', 'England']
d)
['Ireland', 'Wales', 'England']
6.

Which symbols are used to open and close a list?

a)

( ) round brackets

b)

( ) curly brackets

c)

[ ] square brackets

d)

" " speech marks

7.

What is a list in python?

a)

A collection of variables

b)

A collection of items assigned to a single variable

c)

A statement that cant be changed

d)

A Christmas list

8.

This list contains items of what data type?

a)

String

b)

Boolean

c)

Float

d)

Integer

9.

What is the index number for 'Spain'?

['England','Brazil','Spain','France']

a)

0

b)

1

c)

2

d)

3

10.

Which of these codes is correct for creating a list of numbers?

a)

num = ('10','29','37','109')

b)

num = [10, 29, 37, 109]

c)

num == ('10','29','37','109')

d)

num = ['10 29 37 109']

11.

What is used to separate elements in a list?

a)

Bracket

b)

Comma

c)

Full Stop

d)

Space

12.

what will be the Output:

print([1,2,3,4] + 5)

a)

[6,7,8,9,10]

b)

[1,2,3,4,5]

c)

Generates an error

13.

Which of these pieces of code would return the name "Harry" from the following list?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList()

b)

nameList[1]

c)

NameList(4)

d)

nameList["4"]

14.

Consider this list, what will be the highest index the list can have:

li=[1,2,3,4,5]

a)

2

b)

3

c)

4

d)

5

15.

The count() method returns the number of times the specified element appears in the list.

What is the output of this code?

a)

3

b)

2

c)

1

d)

0

16.

Output of this code?

a)

[2,4,6,8,10]

b)

['2','4','6','8','10']

c)

[0,2,4,6,8]

d)

[10,8,6,4,2]

17.

mylist = ["a","b"]

mylist[1] = "c"'

print(mylist)

a)

["a","c"]

b)

["a","b"]

c)

["a","b","c"]

d)

mylist

18.

Which of these operators means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

19.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
20.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
21.
What output will this code produce?
a)
Exeter
b)
4
c)
6
d)
city