Python Programming - Sets
Exercise : Sets - General Questions
- Sets - General Questions
1.
What is the result of the expression
set('python')?
Answer: Option
Explanation:
The
set() constructor converts a string into a set of its characters.
2.
Which method is used to add an element to a set?
Answer: Option
Explanation:
The
add() method is used to add a single element to a set.
3.
What is the purpose of the
set.remove(element) method?
Answer: Option
Explanation:
The
remove() method removes the specified element from the set.
4.
How can you find the intersection of two sets?
Answer: Option
Explanation:
The
intersection() method is used to find the common elements between two sets.
5.
Which of the following statements about sets in Python is not correct?
Answer: Option
Explanation:
Sets in Python do not allow duplicate elements.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers