wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

List Review Quiz

Total questions: 14

Worksheet time: 7mins

Name
Class
Date
1.

What operations cannot be performed on a list?

a)

Update

b)

Modify

c)

Divide

d)

Sort

2.

How do you add an element to the end of a list named my_list?

(a)  

3.

What is the output of the following code?

a)

3

b)

6

c)

12

4.

What is the purpose of a "for" loop?

a)

To define a function

b)

To iterate over a sequence

c)

To use the range function

d)

To use conditional statement

5.
In a list called "players", if you wanted to add a player called "Bob" to the list, which of the following examples of code would be correct?
a)
players.add("Bob")
b)
player.append("Bob")
c)
players.append("Bob")
d)
players.addend("Bob")
6.

You would like to add 7 to the end of this list:

nums = [9, 1, 6, 3, 5, 8, 2]

Select ALL commands that will accomplish this.

a)

nums.append(7)

b)

nums.extend([7])

c)

nums.insert(7, 7)

d)

nums.pop(7)

7.

How do you add the number 5 to the end of a list named `numbers`?

a)

numbers.add(5)

b)

numbers.append(5)

c)

numbers.insert(5)

d)

numbers.extend(5)

8.

Loops in programming start counting from ?

a)

0

b)

1

c)

Any number

9.

Which of the following is the correct way to create the following list of names: 'Tom', 'Jerry', 'Tweetie', 'Sylvester'?

a)

b)

c)

d)

10.

What list would be created by this command: list(range(2, 14, 4))?

a)

[2, 6, 10]

b)

[4, 8, 10, 12, 14]

c)


[4, 8, 10, 12]

d)


[2, 6, 10, 14]

11.

Which of these commands would create a list of numbers starting at 0 and up to (but not including) 9?

a)

list(9)

b)

list(range(9))

c)

list(range(10))

d)


list(range([0, 9]))

12.

Which of the following is the correct way to create an empty list?

a)


empty_list = [0]

b)

empty_list = {}

c)


empty_list = None

d)


empty_list = []

13.

Which of the following lines of code will correctly sort mylist?

a)

mylist.sorted()

b)


sort(mylist)

c)


mylist.sort

d)


mylist.sort()

14.

What will be the output of the following code: print(len([1, 2, 3, 4]))?

a)

3

b)

4

c)

5

d)

None