wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

List in Python

Total questions: 25

Worksheet time: 6mins

Name
Class
Date
1.

Which of the following statement will create list?

a)

a. L1=list( )

b)

b. L1=[1,2,3,4]

c)

c. Both of the above

d)

d. None of the above

2.

Write the output of the following code : list(“welcome”)

a)

a. [‘w’, ‘e’, ‘l’, ‘c’, ‘o’, ‘m’, ‘e’]

b)

b. (‘w’, ‘e’, ‘l’, ‘c’, ‘o’, ‘m’, ‘e’)

c)

c. [‘welcome’]

d)

d. None of the above

3.

Write the output of the following code :

>>> L=[“Amit”,”Anita”,”Zee”,”Longest Word”]

>>> print(max(L))

a)

a. Zee

b)

b. Longest Word

c)

c. Error

d)

d. None of the above

4.

Find out the output

a)

a. Longest Word

b)

b. Zee

c)

c. Amit

d)

d. Error

5.

Find out the output

a)

a. 15 9 1

b)

b. Error

c)

c. Max and Min are only for String Value

d)

d. None of the above

6.

what is the output

a)

a. [6, 7, 8]

b)

b. 6, 7, 8

c)

c. Error

d)

d. 6

7.

Find the output

a)

a. [‘c’ , ‘o’]

b)

b. [‘c’ , ‘o’ , ‘m’]

c)

c. (com)

d)

d. Error

8.

Find the output

a)

a. ['Sumit',‘Naina’]

b)

b. [a]

c)

c. ['Sumit']

d)

d. None of the above

9.

Find out the output

a)

a. [10, 6, 2]

b)

b. [10, 7, 4]

c)

c. Error

d)

d. None of the above

10.

Which command is used to add an element in List named L1

a)

a. L1.add(4)

b)

b. L1.append(4)

c)

c. L1.new(4)

d)

d. None of the above

11.

Find out the output

a)

a. Error

b)

b. 10

c)

c. 10.0

d)

d. 4

12.

Write the output of the following

a)

a. [2, 4, 6, 8, 11]

b)

b. [1, 2, 3, 4, 5.5, 1, 2, 3, 4, 5.5]

c)

c. Error

d)

d. None of the above

13.

write the output of the above

a)

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

b)

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

c)

c. None

d)

d. None of the above

14.

del statement can delete the following from the List?

a)

a. Single Element

b)

b. Multiple Elements

c)

c. All elements along with List object

d)

d. All of the above

15.

Find the output

a)

['A', 2, 3, 4]

[1, 2, 3, 4]

b)

['A', 2, 3, 4]

['A', 2, 3, 4]

c)

[1, 2, 3, 4]

[1, 2, 3, 4]

d)

Error

16.

What type of error is returned by the following statement?

a)

a. IndexError

b)

b. TypeError

c)

c. ValueError

d)

d. None of the above

17.

Result of list slice is also a list?(T/F)

a)

True

b)

False

18.

What we call the operation which is used to extract particular range from a sequence.

a)

a. Slicing

b)

b. range

c)

c. Indexing

d)

d. Replication

19.

Index of last element in list is n-1, where n is total number of elements.(T/F)

a)

True

b)

False

20.

Which of the following is true about List data type in Python?

a)

a. List is a Sequence data type

b)

b. List is mutable

c)

c. List can have elements of different data type

d)

d. All of the above

21.

ist and String are different

a)

a. in reference to their indexing

b)

b. in reference to data type of elements they contain

c)

c. None of the above

d)

d. Both of the above

22.

Write the output of the following:

a)

3

b)

4

c)

9

d)

6

23.

Write the output

a)

3

b)

4

c)

5

d)

6

24.

Which of the following statement will return first element from right of list ‘L’?

a)

a. L[0]

b)

b. L[-1]

c)

c. L[1]

d)

d. None of the Above

25.

If we try to concatenate a list with elements of some other data type, _____________ occurs.

a)

a. SyntaxError

b)

b. SyntaxError

c)

c. TypeError

d)

d. None of the above