Home
MCQS
MCQs Practice Portal - robustlifestyles.com
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=(23,34,65,20,5) print(a[0]+a.index(5))
28
29
27
26
4. Which of the following is not a function of tuple?
update( )
min( )
max( )
count( )
5. 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
6. 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
7. 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
8. Which of the following statement will create an empty tuple?
P = ( ) b.
Q = tuple( )
Both of the above
None of the above
9. Which of the following is a tuple with single element?
t = (1,)
t = 1,
Both of the above
None of the above
10. What is the length of the given tuple? >>> t1=(1,2,(3,4,5)
1
2
3
4
11. 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]
12. 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
13. Which mathematical operator is used to replicate a tuple?
Addition
Multiplication
Exponent
Modulus
14. 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
15. Which function returns the length of tuple?
a. length( )
len( )
size( )
None of the above
16. Write the output of the following : >>>t1 = (1,2) >>> t2 = (2,1) >>> t1 == t2
True
False
Error
None of the above
17. Write the output of the following : >>>t1 = (1,2) >>> t2 = (1.0, 2.0) >>> t1 == t2
True
False
Error
None of the above
18. What type of error is shown by following statement? >>>t1 =(1, 2) >>>t2
ValueError
TypeError
NameError
None of the above
19. Write the output of the following. >>> t1=((1,2),(3,4),(9,)) >>>max(t1)
9
(9,)
(3,4)
None of the above
20. >>>min(t1) will return an error if the tuple t1 contains value of mixed data type.
True
False
Error
None of the above
21. Which of the following function return the frequency of particular element in tuple?
index( )
max( )
count( )
None of the above
22. Which of the following function return the frequency of particular element in tuple?
index( )
max( )
count( )
None of the above
23. Which of the following function return the frequency of particular element in tuple?
index( )
max( )
count( )
None of the above
24. 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
25. 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
Submit