📋 Computational Thinking & Programming-I Quiz 11 — Lists in Python (Class 11 CS)
Practice 20 CBSE Class 11 Computer Science (Code 083) MCQs on Python lists — indexing, list operations (concatenation, repetition, membership, slicing), traversing a list, built-in functions/methods (len(), list(), append(), extend(), insert(), count(), index(), remove(), pop(), sort(), sorted()), nested lists, and suggested programs like finding the max/mean and linear search.
Every method and program result below has been verified by actually running it in Python. Tap any question to reveal the answer with a clear explanation.
📋 List Basics
What is a list in Python?
- An immutable sequence of characters
- An ordered, mutable collection of items
- A fixed-size collection that cannot be changed
- A key-value mapping structure
Show Answer & Explanation
✅ Answer: (b) An ordered, mutable collection of items
A list is an ordered collection of items, written in square brackets like [1, 2, 3], and it’s mutable — items can be added, removed, or changed after creation.
🔢 Indexing
How do you access the first element of the list L = [10, 20, 30] using indexing?
- L[1]
- L(0)
- L[0]
- L.first()
Show Answer & Explanation
✅ Answer: (c) L[0]
Python indexing starts at 0, so L[0] gives the first element (10). L[1] would actually give the second element.
➕ List Operations
What is the result of the expression [1, 2] + [3, 4] in Python?
- [1, 2, 3, 4]
- [4, 6]
- Error
- [1, 2, [3, 4]]
Show Answer & Explanation
✅ Answer: (a) [1, 2, 3, 4]
+ concatenates two lists into one, joining their elements end to end: [1, 2, 3, 4].
➕ List Operations
What is the result of the expression [1, 2] * 2 in Python?
- [2, 4]
- [1, 2, 1, 2]
- Error
- [1, 2]
Show Answer & Explanation
✅ Answer: (b) [1, 2, 1, 2]
* repeats the list’s elements the given number of times: [1, 2, 1, 2].
➕ List Operations
What is the result of the expression 3 in [1, 2, 3] in Python?
- True
- False
- 3
- Error
Show Answer & Explanation
✅ Answer: (a) True
The in operator checks membership — since 3 is present in the list, this evaluates to True.
➕ List Operations
What does the slice L[1:3] return for the list L = [10, 20, 30, 40, 50]?
- [10, 20]
- [20, 30]
- [20, 30, 40]
- [30, 40]
Show Answer & Explanation
✅ Answer: (b) [20, 30]
Slicing [1:3] takes elements from index 1 up to (but not including) index 3 — that’s indices 1 and 2: [20, 30].
🔁 Traversal
Which of the following correctly traverses a list, visiting each element one at a time?
- for item in my_list:
- for item in range(my_list):
- while my_list:
- for item = my_list:
Show Answer & Explanation
✅ Answer: (a) for item in my_list:
for item in my_list: is the standard, direct way to traverse a list, giving you each element in order without needing to manage an index manually.
🧰 Built-in Functions
Which built-in function returns the number of elements in a list?
- count()
- len()
- size()
- index()
Show Answer & Explanation
✅ Answer: (b) len()
len() returns how many elements a list contains, e.g. len([1, 2, 3]) gives 3.
🧰 Built-in Functions
What does the expression list(“abc”) return in Python?
- “abc”
- [‘a’, ‘b’, ‘c’]
- [‘abc’]
- Error
Show Answer & Explanation
✅ Answer: (b) [‘a’, ‘b’, ‘c’]
The list() constructor converts an iterable (like a string) into a list of its individual elements: [‘a’, ‘b’, ‘c’].
🧰 Built-in Functions
What does L.append(4) do if L = [1, 2, 3]?
- Adds 4 to the end: [1, 2, 3, 4]
- Inserts 4 at the start: [4, 1, 2, 3]
- Adds 4 as a nested list: [1, 2, 3, [4]]
- Raises an error
Show Answer & Explanation
✅ Answer: (a) Adds 4 to the end: [1, 2, 3, 4]
append() adds a single item to the very end of the list: [1, 2, 3, 4].
🧰 Built-in Functions
What does L.extend([4, 5]) do if L = [1, 2, 3]?
- [1, 2, 3, [4, 5]]
- [1, 2, 3, 4, 5]
- Error
- [1, 2, 3]
Show Answer & Explanation
✅ Answer: (b) [1, 2, 3, 4, 5]
extend() unpacks its argument and adds each element individually to the end of the list: [1, 2, 3, 4, 5].
🧰 Built-in Functions
What does L.insert(2, 3) do if L = [1, 2, 4]?
- [1, 2, 3, 4]
- [1, 2, 4, 3]
- [3, 1, 2, 4]
- Error
Show Answer & Explanation
✅ Answer: (a) [1, 2, 3, 4]
insert(index, value) places the value at the given position, shifting later elements right: [1, 2, 3, 4].
🧰 Built-in Functions
What does L.count(2) return if L = [1, 2, 2, 3]?
- 1
- 2
- 3
- 0
Show Answer & Explanation
✅ Answer: (b) 2
count() tallies how many times the value appears in the list — 2 occurs 2 times.
🧰 Built-in Functions
What does L.index(6) return if L = [5, 6, 7]?
- 0
- 1
- 2
- Error
Show Answer & Explanation
✅ Answer: (b) 1
index() returns the position of the first matching value — 6 is at index 1.
🧰 Built-in Functions
What does L.remove(2) do if L = [1, 2, 3, 2]?
- Removes all 2s: [1, 3]
- Removes only the FIRST 2: [1, 3, 2]
- Removes only the LAST 2: [1, 2, 3]
- Raises an error
Show Answer & Explanation
✅ Answer: (b) Removes only the FIRST 2: [1, 3, 2]
remove() deletes only the first matching occurrence, scanning left to right: [1, 3, 2].
🧰 Built-in Functions
What does x = L.pop() do if L = [1, 2, 3]? What are x and L afterward?
- x = 1, L = [2, 3]
- x = 3, L = [1, 2]
- x = 3, L = [1, 2, 3]
- Raises an error
Show Answer & Explanation
✅ Answer: (b) x = 3, L = [1, 2]
With no index given, pop() removes and returns the last element: x = 3, and L becomes [1, 2].
🧰 Built-in Functions
What is the difference between L.sort() and sorted(L)?
- They do exactly the same thing
- sort() modifies the list in place and returns None; sorted() returns a new sorted list, leaving the original unchanged
- sort() returns a new list; sorted() modifies in place
- Neither actually sorts the list
Show Answer & Explanation
✅ Answer: (b) sort() modifies the list in place and returns None; sorted() returns a new sorted list, leaving the original unchanged
L.sort() rearranges the list itself and returns None. sorted(L) leaves the original list untouched and gives you a brand-new sorted list instead.
🪆 Nested Lists
For the nested list v = [[1, 2], [3, 4]], what does v[1][0] give?
- 1
- 2
- 3
- 4
Show Answer & Explanation
✅ Answer: (c) 3
Nested indexing works left to right: v[1] gives [3, 4], and [0] of that gives 3.
⭐ Suggested Programs
What does the following program print? (Finding max and mean of a list)
nums = [12, 45, 7, 23, 56, 9] print(max(nums), sum(nums) / len(nums))
- 56 25.33
- 45 25.33
- 56 22.5
- 12 25.33
Show Answer & Explanation
✅ Answer: (a) 56 25.33
The maximum value is 56. The mean is the sum (152) divided by the count (6), giving approximately 25.33.
⭐ Suggested Programs
What does the following linear search & frequency-counting program print?
data = [4, 2, 7, 2, 9, 2, 5]
target = 2
positions = []
for i in range(len(data)):
if data[i] == target:
positions.append(i)
print(positions, len(positions))- [1, 3, 5] 3
- [0, 2, 4] 3
- [1, 3, 5] 2
- [] 0
Show Answer & Explanation
✅ Answer: (a) [1, 3, 5] 3
A linear search checks every position one by one. The value 2 appears at indices 1, 3, and 5, so positions is [1, 3, 5] and its length (the frequency of 2 in the list) is 3.
