In the given example, is the data structure a tuple or a set?
💡 Model Answer
When you see a collection surrounded by parentheses, like (1, 2, 3), it is a tuple. Tuples are ordered and immutable, meaning the elements stay in the same order and you cannot add or remove items after creation. When you see a collection surrounded by curly braces, like {1, 2, 3}, it is a set. Sets are unordered, meaning the elements have no guaranteed order, and they automatically remove duplicates. Sets are mutable; you can add or remove elements after creation. If the example shows a sequence that you can index and that never changes, it is a tuple. If the example shows a collection that you can add to or remove from and that does not preserve order, it is a set. In practice, you would choose a tuple when you need a fixed, ordered collection and a set when you need a collection of unique items with fast membership checks.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.
Get Assisting AI — Starts at ₹500