LIST HANDLING IN PYTHON
MCQ
1. What is the correct way to create a list in Python?
a) list = (1, 2, 3)
b) list = [1, 2, 3]
c) list = {1, 2, 3}
d) list = <1, 2, 3>
✅ Answer: b) list = [1, 2, 3]
2. What will len([10, 20, 30, 40]) return?
a) 3
b) 4
c) 5
d) Error
✅ Answer: b) 4
3. What is the output of list("HELLO")?
a) ['HELLO']
b) ['H', 'E', 'L', 'L', 'O']
c) ('H', 'E', 'L', 'L', 'O')
d) Error
✅ Answer: b) ['H', 'E', 'L', 'L', 'O']
4. Lists in Python are:
a) Mutable
b) Immutable
c) Static
d) Constant
✅ Answer: a) Mutable
5. What is the index of the last element in a list L with 10 elements?
a) 10
b) 9
c) -10
d) 11
✅ Answer: b) 9
6. What is the output of L = [1, 2, 3]; print(L[1])?
a) 1
b) 2
c) 3
d) Error
✅ Answer: b) 2
7. What will L[-1] return for L = [5, 10, 15]?
a) 5
b) 10
c) 15
d) Error
✅ Answer: c) 15
8. What does L[1:3] return for L = [10, 20, 30, 40]?
a) [10, 20]
b) [20, 30]
c) [30, 40]
d) [10, 20, 30]
✅ Answer: b) [20, 30]
9. What will L = [1, 2]; L.append(3) result in?
a) [1, 2]
b) [1, 2, 3]
c) [3, 1, 2]
d) [1, 3, 2]
✅ Answer: b) [1, 2, 3]
10. Which method adds multiple elements to a list?
a) append()
b) extend()
c) insert()
d) add()
✅ Answer: b) extend()
11. What will be output of:
a) [1,10,2,3]
b) [10,1,2,3]
c) [1,2,10,3]
d) Error
✅ Answer: a) [1,10,2,3]
12. Which method removes the first occurrence of a given element?
a) delete()
b) discard()
c) remove()
d) pop()
✅ Answer: c) remove()
13. Which method removes element at a specific index?
a) remove()
b) del()
c) pop()
d) discard()
✅ Answer: c) pop()
14. What will L.pop() do if index is not given?
a) Removes first element
b) Removes last element
c) Removes all elements
d) Throws error
✅ Answer: b) Removes last element
15. What is the output of L = [2,4,6,8]; print(L[::2])?
a) [2,4]
b) [2,6]
c) [4,8]
d) [2,6,8]
✅ Answer: b) [2,6]
16. What will sorted([3,1,2]) return?
a) [3,2,1]
b) [1,2,3]
c) None
d) Error
✅ Answer: b) [1,2,3]
17. Which method reverses the list in place?
a) reverse()
b) reversed()
c) sort()
d) sorted()
✅ Answer: a) reverse()
18. What is the output of max([10, 20, 5])?
a) 5
b) 10
c) 20
d) Error
✅ Answer: c) 20
19. What will sum([1,2,3,4]) return?
a) 10
b) 24
c) 6
d) 12
✅ Answer: a) 10
20. What will be the result of L = [1, 2] * 3?
a) [1, 2, 3]
b) [1, 2, 1, 2, 1, 2]
c) [1, 2, 6]
d) [1, 2, 2, 1, 2, 1]
✅ Answer: b) [1, 2, 1, 2, 1, 2]
21. What does del L[0] do?
a) Deletes first element
b) Deletes entire list
c) Deletes last element
d) Error
✅ Answer: a) Deletes first element
22. What is output of:
a) Removes 4
b) Returns None
c) Raises ValueError
d) Removes 3
✅ Answer: c) Raises ValueError
23. Which function returns smallest element of a list?
a) smallest()
b) min()
c) lowest()
d) first()
✅ Answer: b) min()
24. What is list(range(3))?
a) [1,2,3]
b) [0,1,2]
c) [0,1,2,3]
d) Error
✅ Answer: b) [0,1,2]
25. Which operator is used to check membership?
a) in
b) is
c) ==
d) exists
✅ Answer: a) in
26. What is output of "a" in ["a","b","c"]?
a) True
b) False
c) Error
d) None
✅ Answer: a) True
27. What is output of [x**2 for x in [1,2,3]]?
a) [1,2,3]
b) [2,4,6]
c) [1,4,9]
d) [1,8,27]
✅ Answer: c) [1,4,9]
28. List slicing doesn’t modify the original list.
a) True
b) False
✅ Answer: a) True
29. What will L.clear() do?
a) Delete last element
b) Delete first element
c) Delete all elements
d) None
✅ Answer: c) Delete all elements
30. Which function can be used to copy a list?
a) copy()
b) clone()
c) duplicate()
d) append()
✅ Answer: a) copy()
31. What is the output of
a) [1,2]
b) [1,2,3]
c) Error
d) [3]
✅ Answer: b) [1,2,3]
32. Which of these will create an empty list?
a) []
b) list()
c) Both a and b
d) None
✅ Answer: c) Both a and b
33. What is output of L = [1,2,3]; print(L[::-1])?
a) [1,2,3]
b) [3,2,1]
c) [2,3,1]
d) Error
✅ Answer: b) [3,2,1]
34. Can a list hold different data types?
a) Yes
b) No
c) Only integers
d) Only strings
✅ Answer: a) Yes
35. What will ['a','b'] + ['c'] produce?
a) ['a','b']
b) ['a','b','c']
c) ['c','a','b']
d) Error
✅ Answer: b) ['a','b','c']
36. Which statement will give an error?
a) L = [1,2,3]; L[1]=10
b) L = [1,2,3]; L = L + 4
c) L.append(5)
d) L.extend([4])
✅ Answer: b) Gives error
37. Which statement checks if list is empty?
a) if len(L)==0:
b) if not L:
c) Both a and b
d) None
✅ Answer: c) Both a and b
38. Which of the following creates a nested list?
a) [1,2,3]
b) [[1,2],[3,4]]
c) [(),()]
d) Both b and c
✅ Answer: d) Both b and c
39. What is output of L = [10,20,30]; print(L.index(20))?
a) 0
b) 1
c) 2
d) 3
✅ Answer: b) 1
40. Which method counts the occurrences of a value?
a) find()
b) count()
c) index()
d) sum()
✅ Answer: b) count()
41. What will L = [1,2,2,3]; print(L.count(2)) return?
a) 1
b) 2
c) 3
d) 0
✅ Answer: b) 2
42. Which of these methods can sort a list in descending order?
a) L.sort(reverse=True)
b) L.sort(desc=True)
c) L.reverse()
d) L[::-1]
✅ Answer: a) L.sort(reverse=True)
43. What is output of min([])?
a) 0
b) Error
c) None
d) []
✅ Answer: b) Error
44. What is output of sum([])?
a) 0
b) Error
c) None
d) []
✅ Answer: a) 0
45. Which function returns the number of elements?
a) size()
b) len()
c) count()
d) total()
✅ Answer: b) len()
46. What will list("123") return?
a) [123]
b) ['1','2','3']
c) ('1','2','3')
d) Error
✅ Answer: b) ['1','2','3']
47. Can list contain duplicate values?
a) Yes
b) No
c) Sometimes
d) Only strings
✅ Answer: a) Yes
48. What is output of type([])?
a) <class 'list'>
b) <type 'list'>
c) list
d) Error
✅ Answer: a) <class 'list'>
49. Which operation joins two lists?
a) +
b) join()
c) append()
d) concat()
✅ Answer: a) +
50. Which statement correctly copies a list without reference?
a) L2 = L1
b) L2 = L1.copy()
c) L2 = copy(L1)
d) L2 = L1[:]
✅ Answer: b) L2 = L1.copy()