Home
MCQS
Python MCQ Quiz Hub
Tuple MCQ in Python
Choose a topic to test your knowledge and improve your Python skills
1. Tuples are __________________
Mutable
Immutable
Mutable to some extent
None of the above
2. In tuples values are enclosed in __________________
a. Square brackets
Curly brackets
Parenthesis
None of the above
3. Write the output of the following. A = tuple(“Python”) print(A)
(python)
(“Python”)
(‘P’ , ‘y’ , ‘t’ , ‘h’ , ‘o’ , ‘n’)
None of the above
4. Write the output of the following: A = list(tuple(“Python”)) print(A)
(‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’)
[‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’]
Error
None of the above
5. Write the output of the following. a=(23,34,65,20,5) print(a[0]+a.index(5))
28
29
27
26
6. Which of the following is not a function of tuple?
update( )
min( )
max( )
count( )
7. Write the output of the following: a=(23,34,65,20,5) s=0 for i in a: if i%2==0: s=s+a[i] print(s)
54
93
94
Error
8. Write the output of the following: a=(1, 2, 3, 2, 3, 4, 5) print(min(a) + max(a) + a.count(2))
13
6
8
Error
9. Which of the following is/are features of tuple?
Tuple is immutable
Tuple is a sequence data type
In tuple, elements are enclosed in Parenthesis.
All the above
10. Which of the following is not a tuple?
P = 1,2,3,4,5
Q = (‘a’, ‘b’, ‘c’)
R = (1, 2, 3, 4)
None of the above
11. Which of the following statement will create an empty tuple?
P = ( ) b.
Q = tuple( )
Both of the above
None of the above
12. Which of the following is a tuple with single element?
t = (1,)
t = 1,
Both of the above
None of the above
13. Write the output of the following: >>>t = (1) >>>type(t)
<class ‘int’>
<class ‘float’>
<class ‘tuple’>
<class ‘list’>
14. What is the length of the given tuple? >>> t1=(1,2,(3,4,5)
1
2
3
4
15. Write the output of the following: >>>t1 = (1,2,3,4,5) >>>t2=t1 >>>t2
Error
(1,2,3,4,5)
1,2,3,4,5
[1,2,3,4,5]
16. Write the output of the following: >>>t1= ('a', 'b') >>>t2 = (1,2,3) >>>t2+t1
(‘a’, ‘b’, 1, 2, 3)
(1, 2, 3, ‘a’, ‘b’)
(1, ‘a’, 2, ‘b’, 3)
None of the above
17. Which of the following statement will return an error. T1 is a tuple.
T1 + (23)
T1 + [3]
Both of the above
None of the above
18. Which mathematical operator is used to replicate a tuple?
Addition
Multiplication
Exponent
Modulus
19. Write the output of the following: t1 = (23, 45, 67, 43, 21, 41) print(t1[1:2])
(45)
(45,)
(45, 67)
None of the above
20. Write the output of the following: t1 = ('1', '2', '3', '4', '5') print(t1 + tuple("tuple"))
(‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘t’, ‘u’, ‘p’, ‘l’, ‘e’)
(‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘tuple’)
Error
None of the above
21. Which function returns the length of tuple?
a. length( )
len( )
size( )
None of the above
22. Write the output of the following : >>>t1 = (1,2) >>> t2 = (2,1) >>> t1 == t2
True
False
Error
None of the above
23. Write the output of the following : >>>t1 = (1,2) >>> t2 = (1.0, 2.0) >>> t1 == t2
True
False
Error
None of the above
24. del t1 statement will delete the tuple named ‘t1’
True
False
Error
None of the above
25. What type of error is shown by following statement? >>>t1 =(1, 2) >>>t2
ValueError
TypeError
NameError
None of the above
26. Write the output of the following. >>> t1=((1,2),(3,4),(9,)) >>>max(t1)
9
(9,)
(3,4)
None of the above
27. >>>min(t1) will return an error if the tuple t1 contains value of mixed data type.
True
False
Error
None of the above
28. Which of the following function return the frequency of particular element in tuple?
index( )
max( )
count( )
None of the above
29. Which of the following function return the frequency of particular element in tuple?
index( )
max( )
count( )
None of the above
30. Which of the following function return the frequency of particular element in tuple?
index( )
max( )
count( )
None of the above
31. Write the output of the following : >>> t1=(1,2,3,4,5,6,7) Write the output of the following: a=(“Amit”, “Sumit”,”Ashish”,”Sumanta”) print(max(a)) >>> t1[t1[1]]
Sumanta
Ashish
Sumit
Amit
32. What type of error is returned by following code : a=(“Amit”, “Sumit”,”Ashish”,”Sumanta”) print(a.index(“Suman”))
SyntaxError
ValueError
TypeError
NameError
33. Write the output of the following : a=(“Amit”, “Sumit”,”Ashish”,”Sumanta”) print(a.index(“Sumit”)+4//3**2)
2
4
1
3
34. Write the output of the following: a=(“Amit”, “Sumit”,”Ashish”,”Sumanta”) print(a.count(“Sum”))
1
2
0
Error
35. Write the output of the following : a=("Amit", "Sumit","Ashish","Sumanta") for i in a: print(len(i)**2)
0 1 4 9
16 25 36 49
Error
1 4 9 16
36. Write the output of the following: a=(6,8,9,"Sumanta",1) for i in a: print(str(i)*2)
66 88 99 SumantaSumanta 11
66 88 99 Error
Error
66 88 99 SumantaSumanta Error
37. Write the output of the following: a="blog" b=list(a) c=tuple(b) print(c)
Error b.
[‘b’ , ‘l’ , ‘o’ , ‘g’]
(‘b’ , ‘l’ , ‘o’ , ‘g’) d. (blog)
(blog)
38. Write the output of the following : a=("Hello","How","are","you") for i in a: print(i,end=" ")
“Hello” , “How” , “are” , “you”
Hello , How , are , you
Hello How are you
Error
39. Write the output of the following: a=("Hello","How","are","you") for i in a: print(a.index(i),end=" ")
0 1 2 3
“Hello” , “How” , “are” , “you”
Error
0 2 3
40. Write the output of the following: a=(“Hello”,”How”,”are”,”you”) b=list(a) print(a==b)
SyntaxError b. c.
ValueError
True
False
Submit