Tuples Questions and Answers

Practice Mode
Showing 10 of 25 questions
Q1
Which of the following is the correct way to create a tuple in Python?
  • A tuple = [1, 2, 3]
  • B tuple = (1, 2, 3)
  • C tuple = {1, 2, 3}
  • D tuple = <1, 2, 3>
Answer: Option B
Explanation: Tuples are created using parentheses () or the tuple() constructor. Lists use square brackets [] and dictionaries use curly braces {}.
Q2
What is the key characteristic that distinguishes tuples from lists in Python?
  • A Tuples can store only integers
  • B Tuples are immutable
  • C Tuples use square brackets
  • D Tuples are faster for all operations
Answer: Option B
Explanation: Tuples are immutable while lists are mutable. This means tuple elements cannot be changed after creation.
Q3
How do you access the second element in a tuple called my_tuple?
  • A my_tuple(2)
  • B my_tuple[1]
  • C my_tuple[2]
  • D my_tuple.get(1)
Answer: Option B
Explanation: Tuple elements are accessed using zero-based indexing with square brackets.
Q4
Which method is available for tuples in Python?
  • A append()
  • B remove()
  • C count()
  • D sort()
Answer: Option C
Explanation: Tuples have limited methods compared to lists. count() and index() are the main methods available.
Q5
What will be the output of: tuple1 = (1, 2, 3); tuple2 = tuple1 + (4,); print(tuple2)
  • A (1, 2, 3, 4)
  • B (1, 2, 3)(4)
  • C Error
  • D (1, 2, 3, (4))
Answer: Option A
Explanation: Tuples can be concatenated using the + operator. Adding (4,) creates a new tuple with the additional element.
Q6
How do you create a tuple with only one element?
  • A my_tuple = (5)
  • B my_tuple = (5,)
  • C my_tuple = [5]
  • D my_tuple = tuple(5)
Answer: Option B
Explanation: For single-element tuples, a comma is required after the element to distinguish it from a regular expression in parentheses.
Q7
Which operation is NOT allowed on tuples?
  • A Slicing
  • B Indexing
  • C del my_tuple[0]
  • D Concatenation
Answer: Option C
Explanation: Tuples are immutable, so you cannot modify existing elements. del my_tuple[0] would try to delete an element, which is not allowed.
Q8
What is the result of: my_tuple = (1, 2, 3); print(len(my_tuple))
  • A 1
  • B 2
  • C 3
  • D 6
Answer: Option C
Explanation: The len() function returns the number of elements in the tuple.
Q9
How can you convert a list to a tuple?
  • A tuple = list.to_tuple()
  • B tuple = (list)
  • C tuple = tuple(list)
  • D tuple = convert(list)
Answer: Option C
Explanation: The tuple() constructor can convert any iterable (like lists) to a tuple.
Q10
What does tuple unpacking allow you to do?
  • A Add elements to a tuple
  • B Remove elements from a tuple
  • C Assign tuple elements to variables
  • D Change tuple values
Answer: Option C
Explanation: Tuple unpacking allows assigning tuple elements to individual variables in a single statement.
Questions and Answers for Competitive Exams Various Entrance Test