# Python List MCQ and Output Questions with Answers - Class 10 ICSE
## MULTIPLE CHOICE QUESTIONS (MCQs)
### 1. Which of the following is the correct way to create an empty list in Python?
a) `list = {}`
b) `list = []`
c) `list = ()`
d) `list = ""`
**Answer: b) `list = []`**
**Explanation:** Square brackets `[]` are used to create an empty list. `{}` creates a
dictionary, `()` creates a tuple, and `""` creates an empty string.
### 2. What will be the output of `len([1, 2, [3, 4]])`?
a) 4
b) 3
c) 2
d) 5
**Answer: b) 3**
**Explanation:** The list has 3 elements: 1, 2, and [3, 4]. The nested list [3, 4] is counted as
one element.
### 3. Which method is used to add an element at the end of a list?
a) `insert()`
b) `add()`
c) `append()`
d) `extend()`
**Answer: c) `append()`**
**Explanation:** The `append()` method adds a single element to the end of a list. `insert()`
adds at a specific position, `add()` doesn’t exist for lists, and `extend()` adds multiple
elements.
### 4. What is the index of the last element in a list of 10 elements?
a) 10
b) 9
c) -1
d) Both b and c
**Answer: d) Both b and c**
**Explanation:** In a list of 10 elements, the last element has index 9 (positive indexing) or -1
(negative indexing).
### 5. Which of the following will remove the last element from a list?
a) `list.remove(-1)`
b) `list.pop()`
c) `list.delete(-1)`
d) `list.remove(last)`
**Answer: b) `list.pop()`**
**Explanation:** `pop()` without arguments removes and returns the last element. `remove()`
removes by value, not index, and `delete()` is not a list method.
### 6. What will `[1, 2, 3] + [4, 5]` produce?
a) `[1, 2, 3, 4, 5]`
b) `[5, 7, 8]`
c) `[[1, 2, 3], [4, 5]]`
d) Error
**Answer: a) `[1, 2, 3, 4, 5]`**
**Explanation:** The `+` operator concatenates two lists, combining all elements into a single
list.
### 7. Which slicing operation will reverse a list?
a) `list[-1:]`
b) `list[::-1]`
c) `list[::2]`
d) `list[1::-1]`
**Answer: b) `list[::-1]`**
**Explanation:** The slice `[::-1]` starts from the end and goes to the beginning with step -1,
effectively reversing the list.
### 8. What does `list.count(x)` return?
a) Index of element x
b) Number of occurrences of x
c) True if x exists
d) Position of x
**Answer: b) Number of occurrences of x**
**Explanation:** The `count()` method returns how many times the specified element
appears in the list.
### 9. Which of the following creates a list with 5 zeros?
a) `[0] * 5`
b) `[0, 5]`
c) `list(0, 5)`
d) `range(0, 5)`
**Answer: a) `[0] * 5`**
**Explanation:** Multiplying a list `[0]` by 5 creates `[0, 0, 0, 0, 0]`. The other options don’t
create a list of zeros.
### 10. What will be the result of `list([1, 2, 3])`?
a) `(1, 2, 3)`
b) `[1, 2, 3]`
c) `{1, 2, 3}`
d) Error
**Answer: b) `[1, 2, 3]`**
**Explanation:** The `list()` function converts any iterable to a list. Since `[1, 2, 3]` is already
a list, it returns the same list.
-----
## OUTPUT BASED QUESTIONS
### 1. What will be the output of the following code?
```python
lst = [1, 2, 3, 4, 5]
print(lst[1:4])
```
**Output:** `[2, 3, 4]`
**Explanation:** Slicing `lst[1:4]` extracts elements from index 1 to 3 (4 is excluded). So
elements at indices 1, 2, and 3 are 2, 3, and 4 respectively.
### 2. What will be the output of the following code?
```python
numbers = [10, 20, 30]
numbers.append([40, 50])
print(numbers)
print(len(numbers))
```
**Output:**
```
[10, 20, 30, [40, 50]]
4
```
**Explanation:** `append()` adds the entire list `[40, 50]` as a single element, creating a
nested list. The length is 4 because there are 4 elements: 10, 20, 30, and [40, 50].
### 3. What will be the output of the following code?
```python
data = [1, 2, 3, 4, 5]
print(data[-2])
print(data[-1])
```
**Output:**
```
4
5
```
**Explanation:** Negative indexing starts from -1 (last element). `data[-2]` is the second last
element (4), and `data[-1]` is the last element (5).
### 4. What will be the output of the following code?
```python
lst = ['a', 'b', 'c', 'd']
print(lst[::2])
print(lst[1::2])
```
**Output:**
```
['a', 'c']
['b', 'd']
```
**Explanation:** `lst[::2]` takes every 2nd element starting from index 0: ‘a’ and ‘c’. `lst[1::2]`
takes every 2nd element starting from index 1: ‘b’ and ‘d’.
### 5. What will be the output of the following code?
```python
list1 = [1, 2, 3]
list2 = list1
list2.append(4)
print(list1)
print(list2)
```
**Output:**
```
[1, 2, 3, 4]
[1, 2, 3, 4]
```
**Explanation:** `list2 = list1` creates a reference, not a copy. Both variables point to the
same list object. Modifying `list2` also affects `list1`.
### 6. What will be the output of the following code?
```python
fruits = ['apple', 'banana', 'cherry']
fruits.insert(1, 'orange')
print(fruits)
```
**Output:** `['apple', 'orange', 'banana', 'cherry']`
**Explanation:** `insert(1, 'orange')` inserts ‘orange’ at index 1, shifting existing elements to
the right.
### 7. What will be the output of the following code?
```python
numbers = [5, 2, 8, 1, 9]
numbers.sort()
print(numbers)
```
**Output:** `[1, 2, 5, 8, 9]`
**Explanation:** The `sort()` method sorts the list in ascending order in-place, modifying the
original list.
### 8. What will be the output of the following code?
```python
lst = [1, 2, 3, 2, 4, 2]
print(lst.count(2))
print(lst.index(2))
```
**Output:**
```
3
1
```
**Explanation:** `count(2)` returns the number of times 2 appears in the list (3 times).
`index(2)` returns the index of the first occurrence of 2 (index 1).
### 9. What will be the output of the following code?
```python
data = [1, 2, 3, 4, 5]
result = data.pop(2)
print(result)
print(data)
```
**Output:**
```
3
[1, 2, 4, 5]
```
**Explanation:** `pop(2)` removes and returns the element at index 2 (which is 3). The
original list is modified to remove that element.
### 10. What will be the output of the following code?
```python
lst = ['x', 'y', 'z']
print(lst * 2)
print(lst + lst)
```
**Output:**
```
['x', 'y', 'z', 'x', 'y', 'z']
['x', 'y', 'z', 'x', 'y', 'z']
```
**Explanation:** Both `lst * 2` and `lst + lst` produce the same result - they create a new list
with the elements repeated twice.
### 11. What will be the output of the following code?
```python
matrix = [[1, 2], [3, 4], [5, 6]]
print(matrix[1][0])
print(len(matrix))
```
**Output:**
```
3
3
```
**Explanation:** `matrix[1][0]` accesses the first element of the second inner list (3).
`len(matrix)` returns the number of inner lists (3).
### 12. What will be the output of the following code?
```python
lst = [1, 2, 3]
lst.extend([4, 5])
print(lst)
```
**Output:** `[1, 2, 3, 4, 5]`
**Explanation:** `extend()` adds each element of the given list individually to the original list,
unlike `append()` which would add the entire list as one element.
### 13. What will be the output of the following code?
```python
numbers = [10, 20, 30, 40, 50]
print(numbers[1:4:2])
```
**Output:** `[20, 40]`
**Explanation:** `numbers[1:4:2]` starts from index 1, stops before index 4, with step 2. So it
takes elements at indices 1 and 3: 20 and 40.
### 14. What will be the output of the following code?
```python
lst = [1, 2, 3, 4, 5]
lst.remove(3)
print(lst)
del lst[0]
print(lst)
```
**Output:**
```
[1, 2, 4, 5]
[2, 4, 5]
```
**Explanation:** `remove(3)` removes the first occurrence of value 3. `del lst[0]` removes the
element at index 0 (which is now 1).
### 15. What will be the output of the following code?
```python
lst = ['a', 'b', 'c', 'd', 'e']
print(lst[::-2])
print(lst[-1:-4:-1])
```
**Output:**
```
['e', 'c', 'a']
['e', 'd', 'c']
```
**Explanation:** `lst[::-2]` reverses the list and takes every 2nd element. `lst[-1:-4:-1]` goes
from last element to the element at index -4 (exclusive) in reverse.
These questions cover essential concepts of Python lists including creation, indexing, slicing,
methods, and operations that are important for ICSE Class 10 students.