← All topics
Quiz: Tuples and Sets: questions with answers
15 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What does len({1, 2, 2, 3, 3, 3}) return?
- Q2. Which creates a tuple with one item?
- Q3. What is {1, 2, 3} & {2, 3, 4}?
- Q4. What happens here? (code)
- Q5. What type is x = {}?
- Q6. What does this print? (code)
- Q7. What does this print? (code)
- Q8. What does this print? (code)
- Q9. Why can a tuple be a dictionary key but a list cannot?
- Q10. What does this print? (code)
- Q11. What does this print? (code)
- Q12. What is the easiest way to remove duplicates from a list names when order does not matter?
- Q13. What does this print? (code)
- Q14. What is the difference between s.remove(x) and s.discard(x) for a set s?
- Q15. You store a student's date of birth as (day, month, year) and it should never change. Which type fits best?