Python Programming •
MCQ • Lists
Most Important 30 Objective Question - Lists
Q1. A list in Python is enclosed in:
A) ()
B) []
C) {}
D) <>
Answer: B) []
Explanation:
Lists are created using square brackets.
Example: my_list = [1, 2, 3]
Q2. Which of the following is a valid list?
A) (1,2,3)
B) [1,2,3]
C) {1,2,3}
D) <1,2,3>
Answer: B) [1,2,3]
Explanation:
Square brackets are used for creating lists.
Q3. Lists in Python are:
A) Immutable
B) Mutable
C) Fixed
D) Constant
Answer: B) Mutable
Explanation:
Lists are mutable, meaning their elements can be changed after creation.
Q4. What is the index of the first element in a list?
A) 1
B) 0
C) -1
D) 2
Answer: B) 0
Explanation:
Python uses zero-based indexing.
Q5. Which operator is used to combine two lists?
A) -
B) +
C) *
D) /
Answer: B) +
Explanation:
+ joins two lists together.
Q6. Which operator is used for repeating a list?
A) +
B) *
C) %
D) //
**Answer: B) ***
Explanation:
* repeats the list multiple times.
Example: [1]*3 = [1,1,1]
Q7. Which function returns the length of a list?
A) count()
B) size()
C) len()
D) length()
Answer: C) len()
Explanation:
len() gives the total number of elements.
Q8. Which method adds an element at the end?
A) insert()
B) append()
C) extend()
D) add()
Answer: B) append()
Explanation:
append() adds one element at the end of a list.
Q9. Which method inserts an element at specific position?
A) append()
B) insert()
C) add()
D) join()
Answer: B) insert()
Explanation:
insert(index, value) adds an element at a specific index.
Q10. Which method removes the last element?
A) pop()
B) remove()
C) del()
D) clear()
Answer: A) pop()
Explanation:
pop() removes the last item by default.
Q11. Which method removes a specific value?
A) delete()
B) remove()
C) pop()
D) clear()
Answer: B) remove()
Explanation:
remove(value) deletes the first matching value.
Q12. Which statement deletes a list item using index?
A) remove()
B) del
C) clear()
D) pop() only
Answer: B) del
Explanation:
del list[index] deletes element using index.
Q13. Which method removes all elements from a list?
A) remove()
B) clear()
C) pop()
D) delete()
Answer: B) clear()
Explanation:
clear() empties the entire list.
Q14. Which method sorts a list?
A) order()
B) arrange()
C) sort()
D) sortedlist()
Answer: C) sort()
Explanation:
sort() arranges elements in ascending order by default.
Q15. Which method reverses a list?
A) reverse()
B) backward()
C) flip()
D) rotate()
Answer: A) reverse()
Explanation:
reverse() changes the order of elements.
Q16. What is the output of [1,2,3][0]?
A) 0
B) 1
C) 2
D) 3
Answer: B) 1
Explanation:
Index 0 refers to the first element.
Q17. What is slicing in lists?
A) Deleting list
B) Accessing part of list
C) Sorting list
D) Joining list
Answer: B) Accessing part of list
Explanation:
Slicing allows extracting a portion of a list.
Example: list[1:4]
Q18. What is the output of [10,20,30,40][1:3]?
A) [10,20]
B) [20,30]
C) [30,40]
D) [10,20,30]
Answer: B) [20,30]
Explanation:
Starts from index 1 and stops before index 3.
Q19. Which function gives maximum value?
A) high()
B) max()
C) top()
D) maximum()
Answer: B) max()
Explanation:
max() returns the largest element.
Q20. Which function gives minimum value?
A) min()
B) low()
C) minimum()
D) small()
Answer: A) min()
Explanation:
min() returns the smallest element.
Q21. Which function gives total sum?
A) total()
B) add()
C) sum()
D) plus()
Answer: C) sum()
Explanation:
sum() adds all numeric elements of a list.
Q22. Which method counts occurrences of an element?
A) count()
B) find()
C) search()
D) total()
Answer: A) count()
Explanation:
count() tells how many times an item appears.
Q23. Which method finds index of an element?
A) index()
B) position()
C) search()
D) locate()
Answer: A) index()
Explanation:
index() returns the position of first occurrence.
Q24. Can a list contain different data types?
A) No
B) Yes
C) Only numbers
D) Only strings
Answer: B) Yes
Explanation:
Lists can store integers, strings, floats, etc. together.
Q25. What is nested list?
A) Empty list
B) List inside another list
C) Sorted list
D) Large list
Answer: B) List inside another list
Explanation:
A nested list means one list is stored inside another.
Q26. What is the output of len([1,2,3,4])?
A) 3
B) 4
C) 5
D) Error
Answer: B) 4
Explanation:
There are 4 elements in the list.
Q27. Which statement is true?
A) Lists are immutable
B) Lists are mutable
C) Lists cannot store strings
D) Lists cannot be sliced
Answer: B) Lists are mutable
Explanation:
Elements in lists can be changed.
Q28. Which operator checks membership?
A) ==
B) in
C) is
D) and
Answer: B) in
Explanation:
in checks whether an element exists in the list.
Q29. What is the output of 2 in [1,2,3]?
A) True
B) False
C) Error
D) None
Answer: A) True
Explanation:
Since 2 exists in the list, output is True.
Q30. Which statement is correct?
A) Lists support indexing
B) Lists do not support slicing
C) Lists are fixed size
D) Lists cannot be modified
Answer: A) Lists support indexing
Explanation:
Lists support indexing, slicing, updating, and many useful methods.
Google AdSense Ad Placement Here 📢