Python Programming - Sets
Exercise : Sets - General Questions
- Sets - General Questions
41.
What is the result of the expression
set([1, 2, 3, 4]).intersection(set([3, 4, 5, 6]))?
Answer: Option
Explanation:
The
intersection() method finds the common elements between two sets.
42.
Which method is used to remove and return an arbitrary element from a set?
Answer: Option
Explanation:
The
pop() method removes and returns an arbitrary element from a set.
43.
How do you find the elements that are unique to each set?
Answer: Option
Explanation:
The
symmetric_difference() method returns elements that are unique to each set.
44.
What does the
set.symmetric_difference_update(other_set) method do?
Answer: Option
Explanation:
The
symmetric_difference_update() method updates the set with elements unique to the other set.
45.
How do you convert a list into a set?
Answer: Option
Explanation:
The
set() constructor can be used to convert a list into a set.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers