Python List Quiz

Python List Quiz

1) What is the output of the below Python code?
lst = [2,2,2,1,2,2]
print(lst.count())

2) What is the output of the below Python code?
lst = [2,2,2,1,2,2]
print(lst.reverse())

3) What is the output of the below Python code?
print(list("1"))

4) What is the output of the below Python code?
lst = [2,4,2.0,4.0]
print(lst[-2])

5) What is the output of the below Python code?
lst = [2,4,2.0,4.0]
print(lst[-2:-8:-1])

6) Is this a valid list?
lst = [t,1,3,u,2.0]
print(lst)

7) Python Lists are mutable?

8) Which one will create the empty list?

9) What is the output of the following code?

lst1 = [1,2,3]
lst2 = [4,5,6]
print(lst1 + lst2)

10) What is the output of the following code?

lst = [1,2,3,4,5,6,7,8]
print(lst[-3:-1])

11) What is the output of the following code?

lst = [1,2,3,4,5,6,7,8]
print(lst[-3: 1000])

12) Which method is used to add a list to a list?

13) Which of the following deletes elements from the list by the index number?

14) Which method is used to delete elements from the list by value?

15) How many ways we can copy a list?

16) What is the output of the following code?
print(list(range(5)))

17) What is the output of the code?

print([None]*3)

18) What is the output of the code?

lst = [[1,2,3,[4,5,6]], "Logical"]
print(lst[1])
print(lst[0][3][1])

19) How many ways we can create a list?

20) Which method can be used to add a single value to the list?

21) What is the output of the following code?

str = "Logical"
print(list(str))

22) What is the output of the following code?

name = ["Logical", "Python"]
print(name[0][:])

Your score is

The average score is 59%

0%