Skills101
← All practice quizzes

Quiz: References and Copying

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Why changing one list sometimes changes another. Learn how Python names point to objects, the difference between is and ==, and when to use a shallow or a deep copy.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    a = [1, 2]
    b = a
    b.append(3)
    print(a)
    
  2. Question 2

    What does this print?

    x = [1, 2]
    y = [1, 2]
    print(x == y, x is y)
    
  3. Question 3

    What does this print?

    import copy
    a = [[1], [2]]
    b = copy.copy(a)
    b[0].append(9)
    print(a)
    
  4. Question 4

    When should you use is instead of ==?

  5. Question 5

    Which of these types is mutable?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →