Python Programming - Tuples
Exercise : Tuples - General Questions
- Tuples - General Questions
36.
How do you find the length of a tuple?
Answer: Option
Explanation:
The
len()
function is used to find the length of a tuple.
37.
What is the purpose of the
tuple.count()
method?
Answer: Option
Explanation:
The
count()
method is used to count the occurrences of a specific element in a tuple.
38.
What is the result of the expression
tuple(('a', 'b', 'c'))[::-1]
?
Answer: Option
Explanation:
The
[::-1]
slice reverses the order of elements in the tuple.
39.
Which of the following methods is used to find the index of the first occurrence of a specific element in a tuple?
Answer: Option
Explanation:
The
index()
method is used to find the index of the first occurrence of a specific element in a tuple.
40.
What is the result of the expression
tuple(('cat', 'dog', 'rabbit')) * 2
?
Answer: Option
Explanation:
The '*' operator is used to repeat the elements of the tuple.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers