Python Lists Basics Quiz
A 35-question quiz covering list creation, indexing, appending, inserting, removing, updating, and length checking.
Question 1
Which syntax is used to create a list in Python?
Question 2
How do you access the first element of a list named 'my_list'?
Question 3
Which method adds an element to the end of a list?
Question 4
What does the remove() method do?
Question 5
How do you change the value of the second item in a list?
Question 6
Which function returns the number of items in a list?
Question 7
What happens if you try to access an index that does not exist?
Question 8
What is the result of this code?
fruits = ["apple", "banana", "cherry"]
print(fruits[-1])Question 9
Which method allows you to add an element at a specific position?
Question 10
What does pop() do if no index is specified?
Question 11
What is the output of this code?
numbers = [10, 20, 30]
numbers[0] = 15
print(numbers)Question 12
How do you create an empty list?
Question 13
What is the output?
colors = ["red", "green"]
colors.append("blue")
print(len(colors))Question 14
Which statement correctly removes 'banana' from the list?
fruits = ["apple", "banana", "cherry"]Question 15
What happens when you use insert() at an index larger than the list length?
Question 16
What is the result of this code?
nums = [1, 2, 3]
nums.pop(1)
print(nums)Question 17
Can a list contain items of different data types?
Question 18
What is the output?
a = [10, 20]
b = a
b[0] = 99
print(a[0])Question 19
Which of these is a valid way to delete the item at index 0?
Question 20
What does this code print?
items = ["a", "b", "c", "d"]
print(items[1:3])Question 21
How do you check if 'apple' is in the list 'fruits'?
Question 22
What is the result of multiplying a list by an integer?
print([1, 2] * 2)Question 23
What is the output?
lst = [1, 2, 3]
lst.insert(1, 5)
print(lst)Question 24
Which method clears all items from a list?
Question 25
What happens if you try to remove an item that is not in the list?
Question 26
What is the output?
x = [1, 2, 3]
y = x + [4]
print(y)Question 27
How do you find the index of the first occurrence of 'x'?
Question 28
What is the output?
nums = [5, 10, 15]
nums[1] = 20
print(nums[-2])Question 29
Which of the following creates a list with numbers 0 to 4?
Question 30
What is the output?
a = [1, 2]
a.extend([3, 4])
print(len(a))Question 31
What is the result of this code?
lst = ["a", "b", "c"]
del lst[1]
print(lst)Question 32
What is the output?
data = [1]
data.append(data)
print(len(data))Question 33
Which method reverses the order of the list in place?
Question 34
What is the output?
vals = [10, 20, 30]
vals.insert(0, 5)
print(vals[1])Question 35
What does this code output?
a = [1, 2, 3]
b = a[:]
b[0] = 9
print(a[0])