Python Programming - Sets
Exercise : Sets - General Questions
- Sets - General Questions
26.
What is the purpose of the
set.isdisjoint(other_set)
method?
Answer: Option
Explanation:
The
isdisjoint()
method checks if two sets have no elements in common.
27.
What is the result of the expression
set('abc') ^ set('cde')
?
Answer: Option
Explanation:
The '^' operator performs the symmetric difference, giving elements that are unique to each set.
28.
What is the result of the expression
set('programming') - set('python')
?Answer: Option
Explanation:
The '-' operator performs the set difference, giving elements that are in the first set but not in the second.
29.
Which method is used to check if a set is equal to another set?
Answer: Option
Explanation:
The '==' operator is used to check if two sets are equal.
30.
What is the purpose of the
set.add(element)
method?
Answer: Option
Explanation:
The
add()
method is used to add an element to the set.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers