Python Sequence Collections Quiz
A 30-question quiz focused on Python lists, covering list creation, indexing, slicing, mutation, iteration, list methods, copying behavior, and practical data-handling scenarios.
Question 1
Why are lists considered one of Python's most versatile data structures?
Question 2
What is one advantage of list mutability in Python?
Question 3
A developer needs to maintain the order of elements while storing values that can change over time. Why is a list a suitable choice?
Question 4
Which indexing rule applies to Python lists?
Question 5
Which list method removes and returns the last element by default?
Question 6
Why is append() often preferred when adding items one at a time?
Question 7
What happens when you attempt to access an index outside the boundaries of a list?
Question 8
A developer wants to remove the first occurrence of a specific value in a list. Which method should they use?
Question 9
Why might slicing be used when working with lists?
Question 10
A list stores items representing inventory counts. The system must update values frequently as stock changes. Why is using a list appropriate in this scenario?
Question 11
A program receives a long list of temperature readings, and the developer needs to keep only the first 24 values, representing hourly readings for one day. Why is slicing (readings[:24]) a simple and safe solution for this extraction?
Question 12
A user interface displays product categories stored in a list. New categories must be added at the end of the list as they appear. Why is append() suited for this task?
Question 13
A developer duplicates a list with copy_list = original_list but discovers that modifying copy_list also changes original_list. Why is this happening?
Question 14
A collection of grades must be sorted before generating a report. Why is the sort() method appropriate rather than creating a separate loop to reorder values manually?
Question 15
A developer needs to flatten a list of lists into a single list. Why is using a nested loop or a comprehension like [item for sub in L for item in sub] a common technique?
Question 16
What does this code print?
nums = [10, 20, 30]
print(nums[1])Question 17
What is printed when slicing this list?
vals = [1, 2, 3, 4, 5]
print(vals[1:4])Question 18
What does append() do in this code?
items = ["a"]
items.append("b")
print(items)Question 19
What is printed here?
stuff = [1, 2, 3]
stuff.pop()
print(stuff)Question 20
What does this code print?
data = [3, 1, 2]
data.sort()
print(data)Question 21
What will be the output of this reverse slice?
print([1, 2, 3, 4][::-1])Question 22
What is printed by this nested list access?
grid = [[0, 1], [2, 3]]
print(grid[1][0])Question 23
What is printed here?
vals = [1, 2, 3]
vals.insert(1, 99)
print(vals)Question 24
What does extend() do here?
a = [1, 2]
b = [3, 4]
a.extend(b)
print(a)Question 25
What happens when you use clear()?
nums = [1, 2, 3]
nums.clear()
print(nums)Question 26
Why is list comprehension often preferred over manual loops for creating filtered lists?
Question 27
Why should shallow copying be used cautiously when working with nested lists?
Question 28
A list stores values representing monthly sales. The business needs to compute the total. Why is using sum() considered a clean and idiomatic approach?
Question 29
Why are negative indexes useful when working with lists?
Question 30
What is a common benefit of using enumerate() when iterating over lists?
