Tuples in python: 19 MCQs with answers
All 19 multiple-choice questions from this kit, free and with no sign-up.
Warm-up · 10 questions
Q1. Which of the following is a correct way to create an empty tuple in Python?
BeginnerShow answer & explanation
empty = ()
An empty tuple is created using empty parentheses (). [] creates a list, {} creates a dict, and None is a special value.
Q2. What is the output of `len((1, 2, 3))`?
BeginnerShow answer & explanation
3
The len() function returns the number of elements in the tuple, which is 3.
Q3. Which of the following correctly accesses the second element of tuple `t = (10, 20, 30)`?
BeginnerShow answer & explanation
t[1]
Indexing starts at 0, so the second element is at index 1.
Q4. What is the output of `(1, 2, 3) == (1, 2, 3)`?
BeginnerShow answer & explanation
True
Tuples are compared element-wise; since all elements match, the result is True.
Q5. What is the output of `t = (1, 2, 3); print(t[-1])`?
BeginnerShow answer & explanation
3
Negative indexing starts from the end; -1 refers to the last element, which is 3.
Q6. Which built-in function converts a list to a tuple?
BeginnerShow answer & explanation
tuple()
The tuple() constructor takes an iterable (like a list) and returns a tuple.
Q7. Tuples are mutable in Python.
BeginnerShow answer & explanation
False
Tuples are immutable; their elements cannot be changed after creation.
Q8. A tuple can contain elements of different data types.
BeginnerShow answer & explanation
True
Tuples can hold mixed data types, e.g., (1, 'hello', 3.14).
Q9. The `in` operator can be used to check if an element exists in a tuple.
BeginnerShow answer & explanation
True
The `in` operator works on tuples to test membership.
Q10. Tuples support item assignment like lists.
BeginnerShow answer & explanation
False
Tuples are immutable and do not support item assignment (e.g., t[0] = 5 raises TypeError).
Building up · 9 questions
Q11. Which of the following statements about tuples is TRUE?
IntermediateShow answer & explanation
Tuples are immutable.
Tuples are immutable, meaning their elements cannot be changed after creation. They are ordered and can contain duplicates.
Q12. What is the result of `(1, 2) + (3, 4)`?
IntermediateShow answer & explanation
(1, 2, 3, 4)
The + operator concatenates two tuples, producing a new tuple with all elements from both.
Q13. What does `(1, 2, 3) * 2` return?
IntermediateShow answer & explanation
(1, 2, 3, 1, 2, 3)
The * operator repeats the tuple elements the specified number of times.
Q14. Which method can be used to find the index of a value in a tuple?
IntermediateShow answer & explanation
index()
Tuples have an index() method that returns the first index of a specified value.
Q15. Which of the following is NOT a valid tuple operation?
IntermediateShow answer & explanation
t.append(4)
Tuples are immutable and do not have an append() method. count() and index() are valid tuple methods.
Q16. What is the type of `x` after `x = 1, 2, 3`?
IntermediateShow answer & explanation
tuple
Assigning comma-separated values without parentheses creates a tuple (tuple packing).
Q17. What does `t = (1, 2, 3); a, b, c = t; print(a)` output?
IntermediateShow answer & explanation
1
Tuple unpacking assigns each element to a variable; a gets the first element, 1.
Q18. Which of the following creates a single-element tuple?
IntermediateShow answer & explanation
t = (1,)
A trailing comma is required to create a single-element tuple; (1) is just an integer in parentheses.
Q19. What is the result of `(1, 2, 3).count(2)`?
IntermediateShow answer & explanation
1
The count() method returns the number of times a value appears; 2 appears once.
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Exam prep
Get Veda free See what students get
Free to start · No ads · Works in 42 languages