Sets Questions and Answers
Practice ModeShowing 10 of 25 questions
Q21
Which method returns a copy of the set?
Answer: Option B
Explanation: copy() returns a shallow copy of the set.
Q22
What is the output of: bool(set())?
Answer: Option B
Explanation: An empty set evaluates to False in boolean context, while non-empty sets evaluate to True.
Q23
Which method adds multiple elements to a set?
Answer: Option C
Explanation: update() method adds elements from iterables (lists, tuples, other sets) to the current set.
Q24
What is the result of: 2 in {1, 2, 3}?
Answer: Option A
Explanation: The 'in' keyword checks for membership in sets and returns True if the element is found.
Q25
Which of these creates a set with elements 1, 2, 3?
Answer: Option C
Explanation: Both set([1, 2, 3]) and {1, 2, 3} create sets, but {1, 2, 3} is the preferred literal syntax.