Quizzes

Python Lists Quiz


Welcome to the Python Lists Quiz!

Lists are one of the most important data structures in Python, allowing you to store and manipulate collections of items efficiently. This quiz will test your understanding of lists, including indexing, slicing, methods, and advanced operations.

Each question has four options, but only one correct answer. Good luck!

Table of Contents:


Lists Quiz


Quiz Questions

1. What is a list in Python?

a) A collection of key-value pairs
b) An immutable sequence of characters
c) An ordered, mutable collection of elements
d) A set of unique elements

2. How do you create an empty list?

a) list = ()
b) list = {}
c) list = []
d) list = None

3. What will len([1, 2, 3, 4]) return?

a) 3
b) 4
c) 5
d) Error

4. What will list(range(4)) return?

a) [1, 2, 3, 4]
b) [0, 1, 2, 3, 4]
c) [0, 1, 2, 3]
d) (0, 1, 2, 3)

5. What is the index of the last element in my_list = [10, 20, 30, 40]?

a) 3
b) 4
c) -1
d) 40

6. How do you access the second element of my_list = ['a', 'b', 'c', 'd']?

a) my_list[2]
b) my_list[1]
c) my_list[-2]
d) my_list(2)

7. What does my_list[-1] return?

a) The first element
b) The last element
c) An error
d) None

8. What will my_list = [1, 2, 3]; my_list.append(4) result in?

a) [1, 2, 3]
b) [1, 2, 3, 4]
c) [1, 2, 3, [4]]
d) (1, 2, 3, 4)

9. What method is used to remove an element by value?

a) delete()
b) remove()
c) pop()
d) discard()

10. What will my_list.pop() do?

a) Remove and return the last element
b) Remove and return the first element
c) Delete the list
d) Cause an error

11. What does my_list.extend([5, 6]) do?

a) Adds [5,6] as a single element
b) Replaces the list with [5,6]
c) Adds 5 and 6 separately
d) Causes an error

12. What is the result of my_list = [1, 2, 3] + [4, 5]?

a) [1, 2, 3, 4, 5]
b) [[1, 2, 3], [4, 5]]
c) [1, 2, 3, [4, 5]]
d) Error

13. What does my_list.insert(2, 99) do?

a) Inserts 99 at index 2
b) Adds 99 at the end
c) Removes index 2
d) Causes an error

14. What is the result of sorted([3, 1, 4, 2])?

a) [3, 1, 4, 2]
b) [4, 3, 2, 1]
c) [1, 2, 3, 4]
d) {1, 2, 3, 4}

15. What does my_list.reverse() do?

a) Returns a reversed copy
b) Modifies my_list in place
c) Sorts the list
d) Causes an error

16. Which method is used to count occurrences of an element?

a) index()
b) count()
c) find()
d) search()

17. What happens if you do del my_list[1]?

a) Deletes the first element
b) Deletes the second element
c) Deletes the last element
d) Causes an error

18. What is the output of print([1, 2] * 2)?

a) [1, 2, 1, 2]
b) [2, 4]
c) [1, 2, [1, 2]]
d) [1, 1, 2, 2]

19. What is the output of [i**2 for i in range(3)]?

a) [0, 1, 4]
b) [1, 4, 9]
c) [0, 1, 2]
d) [1, 2, 3]

20. How do you check if an element exists in a list?

a) exists(x, my_list)
b) x in my_list
c) my_list.has(x)
d) find(x, my_list)


How did you do? 🎯

  • 18-20 correct → 🏆 Excellent! You’re a Python functions pro!
  • 14-17 correct → 👍 Great job! Keep practicing.
  • 10-13 correct → 🙂 Good, but there’s room for improvement.
  • Below 10 → 🤔 No worries! Review the concepts and try again.

by AICorr Team

We are proud to offer our extensive knowledge to you, for free. The AICorr Team puts a lot of effort in researching, testing, and writing the content within the platform (aicorr.com). We hope that you learn and progress forward.