wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

aXQtMjktMTEtMjAyMg==

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Ways to create list in python

a)

list1 = list()

b)

list1 = []

c)

list1 = list([1, 2, 3])

d)

list(range(5))

2.

Suppose list1 is [2, 33, 222, 14, 2], What is list1[-1]?

a)

Error

b)

None

c)

25

d)

2

3.

output of the following snippet

hello='world' print(list(hello)[-1])

a)

hello

b)

world

c)

w

d)

d

4.

diffrence between list.append() and list.extends()

a)

both are same

b)

append add single element but extends add another list to the end

c)

there is no extends() method

d)

no diffrence

5.

first_list = [1, 5, 5, 5, 5, 1]

second_list = [1, 2, 3, 4, 5, 6]

print(first_list+second_list)

a)

[1, 5, 5, 5, 5, 1, 1, 2, 3, 4, 5, 6]

b)

[2,7,8,9,10,7]

c)

Error

d)

[0,0,0,0,0,0]

6.

What is the output of the following nested loop

a)

10 Table 20 Chair

b)

20 Table

c)

10 Chair 10 Chair 20 Table 20 Table

d)

10 Chair 10 Table 20 Chair 20 Table

7.

What is the output of the following range() function

for num in range(2,-5,-1): print(num, end=", ")

a)

2, 1, 0

b)

2, 1, 0, -1, -2, -3, -4, -5

c)

2, 1, 0, -1, -2, -3, -4

d)

2, -5, 1

8.

Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?

a)

[2, 33, 222, 14]

b)

Error

c)

25

d)

[25, 14, 222, 33, 2]

9.

What will be the output of the following Python code?

a)

11

b)

12

c)

21

d)

22

10.

Suppose list1 is [1, 3, 2], What is list1 * 2?

a)

[2, 6, 4]

b)

[1, 3, 2, 1, 3]

c)

[1, 3, 2, 1, 3, 2]

d)

[1, 3, 2, 3, 2, 1]