🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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 →
  1. Q1. What does len({1, 2, 2, 3, 3, 3}) return?
  2. Q2. Which creates a tuple with one item?
  3. Q3. What is {1, 2, 3} & {2, 3, 4}?
  4. Q4. What happens here? (code)
  5. Q5. What type is x = {}?
  6. Q6. What does this print? (code)
  7. Q7. What does this print? (code)
  8. Q8. What does this print? (code)
  9. Q9. Why can a tuple be a dictionary key but a list cannot?
  10. Q10. What does this print? (code)
  11. Q11. What does this print? (code)
  12. Q12. What is the easiest way to remove duplicates from a list names when order does not matter?
  13. Q13. What does this print? (code)
  14. Q14. What is the difference between s.remove(x) and s.discard(x) for a set s?
  15. Q15. You store a student's date of birth as (day, month, year) and it should never change. Which type fits best?