Tuples Questions and Answers

Take Exam

Python Programming - Tuples Questions with Answers help learners understand immutable data storage. These Python Tuples Questions are valuable for TCS, Capgemini, and SSC exams, testing sequence data type knowledge

Tuples

Showing 10 of 25 questions

11. What will be the output of: my_tuple = (1, 2, 3); my_tuple[1] = 5

  • (1, 5, 3)
  • (5, 2, 3)
  • TypeError
  • (1, 2, 3)
Show Answer Report

12. Which of these is a valid tuple declaration?

  • my_tuple = (1, "hello", 3.14)
  • my_tuple = [1, "hello", 3.14]
  • my_tuple = {1, "hello", 3.14}
  • my_tuple = 1, "hello", 3.14
Show Answer Report

13. How do you find the index of an element in a tuple?

  • my_tuple.find(2)
  • my_tuple.index(2)
  • my_tuple.search(2)
  • my_tuple.position(2)
Show Answer Report

14. What is tuple repetition?

  • Creating multiple copies of a tuple
  • Removing duplicate elements
  • Sorting tuple elements
  • Merging two tuples
Show Answer Report

15. What will be the output of: my_tuple = (1, 2, 3) * 2

  • (1, 2, 3, 1, 2, 3)
  • (2, 4, 6)
  • (1, 2, 3, 2)
  • Error
Show Answer Report

16. How do you check if an element exists in a tuple?

  • my_tuple.exists(2)
  • 2 in my_tuple
  • my_tuple.contains(2)
  • 2 is in my_tuple
Show Answer Report

17. What is the result of: my_tuple = (5,); print(type(my_tuple))

  • <class 'int'>
  • <class 'tuple'>
  • <class 'list'>
  • <class 'str'>
Show Answer Report

18. How can you delete an entire tuple?

  • my_tuple.clear()
  • del my_tuple
  • my_tuple.delete()
  • remove my_tuple
Show Answer Report

19. What will be the output of: my_tuple = (1, 2, 3, 4, 5); print(my_tuple[1:4])

  • (1, 2, 3)
  • (2, 3, 4)
  • (2, 3, 4, 5)
  • (1, 2, 3, 4)
Show Answer Report

20. Which of the following is true about nested tuples?

  • Tuples cannot contain other tuples
  • Nested tuples are not allowed in Python
  • Tuples can contain other tuples
  • Only lists can be nested in tuples
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test