Bird
0
0

Which Swift set operation returns all unique elements from both sets combined?

easy📝 Conceptual Q2 of 15
Swift - Collections
Which Swift set operation returns all unique elements from both sets combined?
Aintersection
Bunion
Csubtracting
DsymmetricDifference
Step-by-Step Solution
Solution:
  1. Step 1: Recall the meaning of union

    The union of two sets includes every element from both sets, without duplicates.
  2. Step 2: Match with Swift set operations

    Swift's union method returns a new set with all unique elements from both sets combined.
  3. Final Answer:

    union -> Option B
  4. Quick Check:

    Union = All unique elements combined [OK]
Quick Trick: Union merges all unique elements from both sets [OK]
Common Mistakes:
  • Confusing union with intersection
  • Thinking union removes elements
  • Mixing up with symmetricDifference

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Swift Quizzes