Python Programming - Tuples
Exercise : Tuples - General Questions
- Tuples - General Questions
6.
Which of the following statements about tuples in Python is correct?
Answer: Option
Explanation:
Tuples in Python can contain other tuples, allowing nesting to any level.
7.
How do you convert a list to a tuple?
Answer: Option
Explanation:
The
tuple()
constructor can be used to convert a list to a tuple.
8.
What is the result of the expression
(1, 2, 3) + (4, 5, 6)
?
Answer: Option
Explanation:
The '+' operator concatenates tuples in Python.
9.
Which method is used to find the index of a specific element in a tuple?
Answer: Option
Explanation:
The
index()
method is used to find the index of a specific element in a tuple.
10.
What is the output of
len((1, [2, 3], 'hello'))
?
Answer: Option
Explanation:
The
len()
function returns the number of elements in the tuple, and in this case, there are three elements.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers