vicki_charles
vicki_charles 21h ago โ€ข 0 views

Python Lists Quiz: Test Your Knowledge of Python Data Structures

Hey everyone! ๐Ÿ‘‹ Ready to supercharge your Python skills? Lists are fundamental, and knowing them inside out is key to becoming a proficient programmer. Let's test your knowledge with a quick quiz! ๐Ÿ
๐Ÿ’ป Computer Science & Technology
๐Ÿช„

๐Ÿš€ Can't Find Your Exact Topic?

Let our AI Worksheet Generator create custom study notes, online quizzes, and printable PDFs in seconds. 100% Free!

โœจ Generate Custom Content

1 Answers

โœ… Best Answer
User Avatar
carolyn706 Mar 11, 2026

๐Ÿ“š Quick Study Guide

  • ๐Ÿ’ก What are Lists? Lists are ordered, mutable collections of items. They are one of the most versatile data structures in Python and can hold elements of different data types.
  • ๐Ÿ”ข Indexing & Slicing: Elements in a list are accessed by their index, which starts at 0. Slicing allows you to extract a sub-list using `[start:end:step]`. Negative indexing can be used to access elements from the end of the list.
  • โž• Common Operations:
    • โœจ append(item): Adds a single item to the end of the list.
    • ๐Ÿ—‘๏ธ insert(index, item): Inserts an item at a specified index, shifting subsequent elements.
    • โœ‚๏ธ pop(index): Removes and returns the item at a given index. If no index is specified, it removes and returns the last item.
    • โŒ remove(value): Removes the first occurrence of a specified value from the list.
    • ๐Ÿ“ len(list): Returns the number of items in the list.
    • ๐Ÿ”„ sort(): Sorts the list in-place (modifies the original list).
    • โ†ฉ๏ธ reverse(): Reverses the order of elements in the list in-place.
    • โž• + operator: Used to concatenate (join) two or more lists.
    • โœ–๏ธ * operator: Used to repeat a list a specified number of times.
  • ๐Ÿง Mutability: Lists are mutable, meaning their elements can be changed, added, or removed after the list has been created.
  • ๐Ÿง  Nested Lists: Lists can contain other lists, allowing for the creation of complex, multi-dimensional data structures.

๐Ÿ“ Practice Quiz

1. Which of the following is the correct way to create an empty list in Python?

  1. my_list = {}
  2. my_list = ()
  3. my_list = []
  4. my_list = new list()

2. What is the output of my_list = [10, 20, 30]; my_list.append(40); print(my_list)?

  1. [10, 20, 30]
  2. [10, 20, 30, 40]
  3. [40, 10, 20, 30]
  4. Error

3. How do you access the element 'banana' from the list fruits = ['apple', 'banana', 'cherry']?

  1. fruits[2]
  2. fruits.get(1)
  3. fruits[1]
  4. fruits(1)

4. What will be the value of my_list after my_list = [1, 2, 3, 4, 5]; my_list.remove(3);?

  1. [1, 2, 4, 5]
  2. [1, 2, 3, 4]
  3. [1, 2, 5]
  4. Error

5. Which method is used to add an element at a specific index in a list?

  1. add()
  2. push()
  3. insert()
  4. put()

6. What is the output of list1 = [1, 2, 3]; list2 = [4, 5]; list3 = list1 + list2; print(list3)?

  1. [1, 2, 3, 4, 5]
  2. [1, 2, 3], [4, 5]
  3. [[1, 2, 3], [4, 5]]
  4. Error

7. Lists in Python are:

  1. Immutable and unordered
  2. Mutable and ordered
  3. Immutable and ordered
  4. Mutable and unordered
Click to see Answers

1. C

2. B

3. C

4. A

5. C

6. A

7. B

Join the discussion

Please log in to post your answer.

Log In

Earn 2 Points for answering. If your answer is selected as the best, you'll get +20 Points! ๐Ÿš€