Python MCQ Quiz Hub

Tuple MCQ in Python

Choose a topic to test your knowledge and improve your Python skills

1. Tuples are __________________




2. In tuples values are enclosed in __________________




3. Write the output of the following. A = tuple(“Python”) print(A)




4. Write the output of the following: A = list(tuple(“Python”)) print(A)




5. Write the output of the following. a=(23,34,65,20,5) print(a[0]+a.index(5))




6. Which of the following is not a function of tuple?




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)




8. Write the output of the following: a=(1, 2, 3, 2, 3, 4, 5) print(min(a) + max(a) + a.count(2))




9. Which of the following is/are features of tuple?




10. Which of the following is not a tuple?




11. Which of the following statement will create an empty tuple?




12. Which of the following is a tuple with single element?




13. Write the output of the following: >>>t = (1) >>>type(t)




14. What is the length of the given tuple? >>> t1=(1,2,(3,4,5)




15. Write the output of the following: >>>t1 = (1,2,3,4,5) >>>t2=t1 >>>t2




16. Write the output of the following: >>>t1= ('a', 'b') >>>t2 = (1,2,3) >>>t2+t1




17. Which of the following statement will return an error. T1 is a tuple.




18. Which mathematical operator is used to replicate a tuple?




19. Write the output of the following: t1 = (23, 45, 67, 43, 21, 41) print(t1[1:2])




20. Write the output of the following: t1 = ('1', '2', '3', '4', '5') print(t1 + tuple("tuple"))




21. Which function returns the length of tuple?




22. Write the output of the following : >>>t1 = (1,2) >>> t2 = (2,1) >>> t1 == t2




23. Write the output of the following : >>>t1 = (1,2) >>> t2 = (1.0, 2.0) >>> t1 == t2




24. del t1 statement will delete the tuple named ‘t1’




25. What type of error is shown by following statement? >>>t1 =(1, 2) >>>t2




26. Write the output of the following. >>> t1=((1,2),(3,4),(9,)) >>>max(t1)




27. >>>min(t1) will return an error if the tuple t1 contains value of mixed data type.




28. Which of the following function return the frequency of particular element in tuple?




29. Which of the following function return the frequency of particular element in tuple?




30. Which of the following function return the frequency of particular element in tuple?




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]]




32. What type of error is returned by following code : a=(“Amit”, “Sumit”,”Ashish”,”Sumanta”) print(a.index(“Suman”))




33. Write the output of the following : a=(“Amit”, “Sumit”,”Ashish”,”Sumanta”) print(a.index(“Sumit”)+4//3**2)




34. Write the output of the following: a=(“Amit”, “Sumit”,”Ashish”,”Sumanta”) print(a.count(“Sum”))




35. Write the output of the following : a=("Amit", "Sumit","Ashish","Sumanta") for i in a: print(len(i)**2)




36. Write the output of the following: a=(6,8,9,"Sumanta",1) for i in a: print(str(i)*2)




37. Write the output of the following: a="blog" b=list(a) c=tuple(b) print(c)




38. Write the output of the following : a=("Hello","How","are","you") for i in a: print(i,end=" ")




39. Write the output of the following: a=("Hello","How","are","you") for i in a: print(a.index(i),end=" ")




40. Write the output of the following: a=(“Hello”,”How”,”are”,”you”) b=list(a) print(a==b)