30 Python Tuple MCQ for Coding Interviews (2025)

Welcome to this ultimate Python tuple MCQ quiz! Here, we have collected 30 questions based on tuple in Python, which will cover basic to advanced concepts. This MCQ quiz will test your knowledge in tuple as well as level up your understanding in tuple.

Whether you’re a beginner or an experienced Python programmer, this quiz is perfect for coding interviews, competitive programming, and enhancing your knowledge in Python tuple. So, are you ready to score 30/30? Let’s see, how well do you really understand Python tuple? Let’s begin with question number 1.πŸ‘‡

1. What is a tuple in Python?
A. A mutable sequence of elements.
B. An unordered collection of unique elements.
C. An ordered, immutable sequence of elements.
D. A dictionary without keys.
c
A tuple is an ordered collection of elements. It preserves our insertion order in which we have placed elements in the order. A tuple is an immutable data type, meaning we cannot make an update or change in the existing tuple object.
2. What is the correct way to create a tuple in Python?
A. t = [1, 2, 3]
B. t = {1, 2, 3}
C. t = (1, 2, 3)
D. t = tuple[1, 2, 3]
c
Tuples are created using parentheses (), so (1, 2, 3) is the correct syntax.
3. What will be the type of t = (5)?
A. tuple
B. int
C. list
D. str
b
The type of (5) is int because Python interpreter will treat it as an integer in parentheses, not a tuple. To create a tuple with single element, use a trailing comma like this (5,).
4. What will the statement print(len((1, 2, 3, 4))) print?
A. 1
B. 2
C. 3
D. 4
d
The tuple has four elements, so the length is 4.
5. Which of the following operations is not allowed on a tuple?
A. Concatenation
B. Indexing
C. Appending
D. Slicing
c
Tuples do not support append(), pop(), and sort() functions because they are immutable.
6. What will be the output of the following code?
my_tuple = (10, 20, 30, 40)
print(my_tuple[2])
A. 10
B. 20
C. 30
D. 40
c
Indexing in Python starts at 0, so t[2] is the third element, which is 30.
7. What happens when you try to modify a tuple element like this?
my_tuple = (1, 2, 3, 4)
my_tuple[1] = 5
print(my_tuple)
A. (1, 5, 3, 4)
B. (1, 2, 3, 4, 5)
C. (5, 2, 3, 4)
D. TypeError
d
Tuples are immutable. You cannot change their elements after creation.
8. What will be the output of the following code if no error?
my_tuple = (1, 2, [3, 4])
my_tuple[2][0] = 5
print(my_tuple)
A. TypeError
B. (1, 2, 5, 4)
C. (1, 2, [5, 4])
D. (1, 2, [3, 5])
c
Since tuples are immutable in nature. You cannot modify after creation. However, tuple contains a mutable object (like a list), the contents of that object can be modified.
9. What is the expected output of the below Python code?
my_tuple = (1, [2, 3], 4)
my_tuple[1].append(5)
print(my_tuple)
A. (1, [5, 2, 3], 4)
B. (1, [2, 5, 3], 4)
C. (1, [2, 3, 5], 4)
D. TypeError
c
The list inside the tuple is mutable, so append(5) works on it.
10. How can you concatenate two tuples a = (1, 2) and b = (3, 4)?
A. a + b
B. a.append(b)
C. concat(a, b)
D. All of the above
a
Tuples support the + operator for concatenation. The + operator concatenates tuples, and creates a new tuple with all elements. If you concatenate both tuples, the output of (1, 2) + (3, 4) = (1, 2, 3, 4).
11. What will be the output of the statement print(tuple(“hello”))?
A. (‘h’, ‘e’, ‘l’, ‘l’, ‘o’)
B. (‘hello’)
C. TypeError
D. ‘hello’
a
When you pass a string to tuple(), Python converts it into a tuple of individual characters. Therefore, the output is (‘h’, ‘e’, ‘l’, ‘l’, ‘o’).
12. What will be the result of the following Python program?
t1 = (1, 2,)
t2 = (1, 2)
print(t1 is t2)
print(t1 == t2)
A. True True
B. True False
C. False True
D. False False
a
The line t1 == t2 checks that the contents are the same. Since both are identical, it returns True. The second line t1 is t2 checks that both refer to the same object in memory. Since it is same, so the output is also True.
13. What is the output of this code?
def func(x, y, z):
    print(x, y, z)

args = (1, 2, 3)
func(*args)
A. (1, 2, 3)
B. func(*args)
C. 1 2 3
D. Error
c
The *args unpacks the tuple and passes each value as a separate argument to the function.
14. Which of these operations will raise an error?
A. () + ()
B. (1, 2) * 3
C. (1, 2)[1]
D. (1, 2).remove(2)
d
Tuples have no remove() method.
15. What is the output of the following Python code?
my_tuple = (1, 2, 3) * 3
print(my_tuple[1])
print((1, 2, 3)[2])
A. 1 2
B. 2 3
C. 2 2
D. 2 Error
b
(1, 2, 3) * 3 means this will repeat the tuple three times. So, (1, 2, 3) * 3 β†’ (1, 2, 1, 2, 1, 2). Then, you are accessing the second element at index 1, which is 2. Next, (1, 2, 3) is a tuple with two elements: index 0 β†’ 1, index 1 β†’ 2, index 2 β†’ 3. (1, 2, 3)[2] accesses the element at index 2, which is 3.
16. What is the expected output of the following Python code?
my_tuple = (1, 2, 3) * 2
print(my_tuple[my_tuple[1]])
A. 1
B. 2
C. 3
D. 4
c
The line my_tuple = (1, 2, 3) * 2 will give (1, 2, 3, 1, 2, 3). Then, my_tuple[1] results 2. After that, my_tuple[2] outputs 3.
17. Which of the following is the correct output for the Python code?
my_tuple = ([1, 2], [3, 4, 5])
my_tuple[0][1:] = [99]
print(my_tuple)
A. ([1, 2, 99], [3, 4, 5])
B. ([1, 99], [3, 4, 5])
C. ([99], [3, 4, 5])
D. ([1, [99]], [3, 4, 5])
b
The tuple my_tuple contains two lists, which are mutable. my_tuple[0] is [1, 2]. my_tuple[0][1:] = [99] means replacing elements from index 1 onwards in the list [1, 2] with [99]. So. [1, 2] becomes [1, 99]. The tuple itself isn’t modified, but the list inside it is.
18. What will be the output if no error found in the below code?
a = (1, 2, [3, 4])
a[2] += [5, 6]
print(a)
A. (1, 2, [3, 4, 5, 6])
B. (1, 2, [3, 4])
C. TypeError: ‘tuple’ object does not support item assignment
D. Both A and C occur
c
Since tuples are immutable in nature, so if you modify them directly raises a TypeError. However, the list inside the tuple is mutable, the operation a[2] += [5, 6] still modifies the list. This is a tricky behavior where the operation succeeds in modifying the list but still raises an error.
19. Choose the output of the following Python program.
my_tuple = (10, 20, 30, 20, 50, 60)
print(min(my_tuple) + max(my_tuple) + my_tuple.count(20))
A. 50
B. 60
C. 70
D. 72
d
The min(my_tuple) finds the smallest number in the tuple, which is 10. The max(my_tuple) finds the largest number in the tuple, which is 70. The my_tuple.count(20) counts how many times 20 appears in the tuple, which is 2. So, 10 + 70 + 2 = 72.
20. Which of the following will create an empty tuple?
A. my_tuple = ()
B. my_tuple = tuple()
C. Both of the above
D. None
c
The line my_tuple = () directly creates an empty tuple using tuple literal syntax. my_tuple = tuple() also creates an empty tuple using the tuple constructor (built-in tuple() function).
21. Which of the following is not a tuple in Python?
A. t = 1, 2, 3, 4, 5
B. t = (1, 2, 3, 4, 5)
C. t = (‘a’, ‘b’, ‘c’, ‘d’)
D. t = (‘only one element’)
d
You can define a tuple using commas, no need for parentheses. You can also create a tuple with parentheses and commas. The option C is also correct because tuple contains string elements. The option D is not valid because it is just a string in parentheses. To make a single-element tuple, you need a comma, like this t = (‘only one element’,).
22. What is the length of the given tuple in Python?
my_tuple = (10, 20, [30, 20])
print(len(my_tuple))
A. 2
B. 3
C. 4
D. 5
b
The len() function returns the number of top-level elements in the tuple β€” not the length of any inner items. A list [30, 20], which itself has 2 items, but is still 1 item in the tuple.
23. Choose the correct output of the below Python code.
t = (1, 2, 3, 4, 5)
print(t[1:2])
print(t[1:3])
print(t[1:1])
A. (2) (2, 3) ()
B. (2,) (2, 3) (1)
C. (2) (2, 3, 4) (1, 2)
D. (2, 2, 3, 1)
b
Slicing follows the syntax: tuple[start:stop:step]. Python represents single-element tuple with a trailing comma to distinguish them from regular parentheses. Without the comma, (2) would be interpreted as the integer 2. t[1:1] β†’ () (empty tuple because start and stop are equal).
24. What will be the expected output of the following Python code?
(t1, t2) = tuple("25")
print(t2 + t1)
print(t1 + t2)
A. 25, 52
B. 52, 25
C. 50 50
D. 7 7
b
In the above code, “25” is a string, and tuple(“25”) turns it into a tuple of characters. So, tuple(“25”) β†’ (‘2’, ‘5’). When we unpack it, we will get t1 = ‘2’ and t2 = ‘5’. Now the line print(‘5’ + ‘2’) will give ’52’ and print(‘2’ + ‘5’) β†’ ’25’. Hence, the output is 52 and 25.
25. Which output is correct for the given Python code?
my_tuple = ("Amit", "Sumit", "Ashish", "Sumanta")
print(max(my_tuple))
A. Amit
B. Sumit
C. Sumanta
D. Ashish
b
When you call the max() function on strings, it performs lexicographical (dictionary) comparison. This function compares strings character by character using their Unicode/ASCII values. Comparison is case-sensitive, so uppercase letters have lower Unicode values than lowercase. The first letter of each string is compared. If found equal, moves to the second letter for comparing, and so on. The ASCII value of A is 65 and S is 83. So, ‘S’ > ‘A’ (83 > 65). Between “Sumit” and “Sumanta”, the first 3 letters are the same, but the ASCII value of fourth letter (i.e. i) is 105, which is greater than letter a (ASCII is 97). Therefore, summit is output. However, “Sumanta” is longer in length, but the max() function doesn’t consider length.
26. What is the output of print((1, 2) < (1, 2, -1)) statement in Python?
A. True
B. False
C. TypeError
D. None
a
Tuples are compared lexicographically (element by element). The first two elements are equal, but the second tuple is longer, so the first tuple is considered “smaller.”
27. What will be the output of print(tuple({1: ‘a’, 2: ‘b’, 3: ‘c’}))?
A. (1, 2, 3)
B. (‘a’, ‘b’, ‘c’)
C. ((1, ‘a’), (2, ‘b’), (3, ‘c’))
D. TypeError
a
When a dictionary is converted to a tuple, only the keys are retained. If you want key-value pairs, use tuple(dict.items()).
28. What type of error is returned by the following Python code?
my_tuple = ('a', 'b', 'c', 'd')
print(my_tuple.index('e'))
A. TypeError
B. NameError
C. SyntaxError
D. ValueError
d
The method my_tuple.index(‘e’) tries to find the index of the element ‘e’ in the tuple. But ‘e’ is not present in the tuple, so Python raises a ValueError. The method index(value) returns the first index of the value if it exists. If the value is not found, it raises a ValueError.
29. What will be the output of:
my_tuple = ("Ivaan", "Saanvi", "Tripti")
print(my_tuple.index("Saanvi") + 4//3 ** 2)
A. 4
B. 3
C. 2
D. 1
d
my_tuple.index(“Saanvi”) returns 1. The operator precedence in Python follows this order: Exponentiation (**) β†’ Integer division (//) β†’ Addition (+). So, 3 ** 2 β†’ 9 and 4 // 9 β†’ 0 (since 4 divided by 9 is 0.44, integer division gives 0). So, the output is 1.
30. What is the output of following program code?
my_tuple = ("Ivaan", "Saanvi", "Tripti")
print(my_tuple.count("aa"))
A. 2
B. 1
C. 0
D. TypeError
c
The count() method counts occurrences of an exact element in the tuple. It does not perform substring searching within elements. It checks for whole-item matches, not partial matches. Therefore, the output is 0.

Quiz Results

0
Total Questions
0
Correct Answers
0
Incorrect Answers
0%
Score
You can do better next time!