🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: References and Copying: all 10 questions

Quiz: References and Copying · Question 8 of 10

Which call copies a nested list so that no inner list is shared?

Which call copies a nested list so that no inner list is shared?

  1. A.a.copy()
  2. B.a[:]
  3. C.list(a)
  4. D.copy.deepcopy(a)
Answer & explanation

Correct answer: copy.deepcopy(a)

The first three are shallow copies. Only deepcopy copies the inner objects too.

Can you get the rest right without peeking?

Take the timed Quiz: References and Copying quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →