Python List Quiz 15

Test your Python list knowledge with 20 important MCQs! This Python List Quiz covers list manipulation, slicing, methods, comprehensions, and memory concepts crucial for data analysts, data scientists, and Python developers preparing for jobs and technical interviews. Let us start with the Online Python List Quiz now.

Online Python List Quiz with Answers

Online Multiple Choice Questions about Lists in Python

1. What does list.sort() return?

 
 
 
 

2. What is the difference between append() and extend()?

 
 
 
 

3. What function returns a sorted list?

 
 
 
 

4. Which of the following are valid methods to manipulate lists in Python?

 
 
 
 
 
 

5. What is the most efficient way to create a copy of a list?

 
 
 
 

6. What will be the output of the following code?

my_list = [3, 1, 4, 1, 5]
my_list.append(9)
print(len(my_list))

 
 
 
 

7. Which of the following statements about Python lists and tuples are true?

 
 
 
 
 

8. Which of the following are valid ways to create a Pandas series?

 
 
 
 
 

9. Which method removes and returns the last element of a list?

 
 
 
 

10. What does list1 + list2 do?

 
 
 
 

11. What is the output of the following code?
python

my_list = [1, 2, 3, 4, 5]
print(my_list[1:4])

 
 
 
 

12. Which list comprehension creates [0, 1, 4, 9, 16]?

 
 
 
 

13. What is the output?

list1 = [1, 2, 3]
list2 = list1
list3 = list1[:]
list2[0] = 10
list3[1] = 20
print(list1)

 
 
 
 

14. What is the output?

matrix = [[1, 2], [3, 4]]
flat = [num for row in matrix for num in row]
print(flat)

 
 
 
 

15. Which of the following characteristics apply to lists in Python?

 
 
 
 
 

16. What is the output?

a = [1, 2, 3]
b = a
b.append(4)
print(a)

 
 
 
 

17. How can you change an element in a list in Python?

 
 
 
 

18. What does this list comprehension do?

result = [x for x in range(10) if x % 2 == 0]

 
 
 
 

19. Which of the following can be used to manipulate lists in Python?

 
 
 
 
 

20. After executing the following code segment, what will be the value of list L?

L=[1,3,2]
sorted(L)

 
 
 
 

Question 1 of 20

Online Python List Quiz with Answers

  • After executing the following code segment, what will be the value of list L? L=[1,3,2] sorted(L)
  • What function returns a sorted list?
  • How can you change an element in a list in Python?
  • Which of the following characteristics apply to lists in Python?
  • Which of the following statements about Python lists and tuples are true?
  • Which of the following are valid methods to manipulate lists in Python?
  • Which of the following can be used to manipulate lists in Python?
  • What will be the output of the following code? my_list = [3, 1, 4, 1, 5] my_list.append(9) print(len(my_list))
  • Which of the following are valid ways to create a Pandas series?
  • What is the output of the following code? python my_list = [1, 2, 3, 4, 5] print(my_list[1:4])
  • What does list1 + list2 do?
  • What is the difference between append() and extend()?
  • What is the output? a = [1, 2, 3] b = a b.append(4) print(a)
  • Which list comprehension creates [0, 1, 4, 9, 16]?
  • What does this list comprehension do? result = [x for x in range(10) if x % 2 == 0]
  • What is the output? list1 = [1, 2, 3] list2 = list1 list3 = list1[:] list2[0] = 10 list3[1] = 20 print(list1)
  • Which method removes and returns the last element of a list?
  • What is the output? matrix = [[1, 2], [3, 4]] flat = [num for row in matrix for num in row] print(flat)
  • What does list.sort() return?
  • What is the most efficient way to create a copy of a list?

Statistics and Data Analysis

Leave a Comment