Python Programming - Sets
Exercise : Sets - General Questions
- Sets - General Questions
31.
Which method is used to find the intersection of multiple sets?
Answer: Option
Explanation:
The
intersection_update()
method is used to find the intersection of multiple sets.
32.
How do you remove a specific element from a set without raising an error if the element is not present?
Answer: Option
Explanation:
The
discard()
method removes a specific element without raising an error if the element is not present.
33.
What is the purpose of the
set.copy()
method?
Answer: Option
Explanation:
The
copy()
method creates a shallow copy of the set.
34.
What is the result of the expression
len(set())
?
Answer: Option
Explanation:
An empty set has a length of 0.
35.
What does the
set.union(other_set)
method do?
Answer: Option
Explanation:
The
union()
method combines two sets and removes duplicate elements.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers