Python Programming - Tuples
Exercise : Tuples - General Questions
- Tuples - General Questions
46.
How do you convert a tuple to a string?
Answer: Option
Explanation:
The
str()
function is used to convert a tuple to a string.
47.
What is the result of the expression
tuple((1, 2, 3)) * 3
?
Answer: Option
Explanation:
The '*' operator is used to repeat the elements of the tuple.
48.
What does the
tuple()
function do when given a list as an argument?
Answer: Option
Explanation:
The
tuple()
function can be used to convert a list into a tuple.
49.
What is the result of the expression
len(('apple',))
?
Answer: Option
Explanation:
The
len()
function returns the number of elements in the tuple, which is 1 in this case.
50.
How can you check if two tuples are equal?
Answer: Option
Explanation:
The '==' operator is used to check if two tuples are equal.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers