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

Quiz: Copy Constructor and Deep Copy · Question 3 of 10

What is a shallow copy?

What is a shallow copy?

  1. A.A copy that copies only the first member
  2. B.A copy where pointer members are copied as addresses, so both objects share the same data
  3. C.A copy made on the stack
  4. D.A copy that is optimised away
Answer & explanation

Correct answer: A copy where pointer members are copied as addresses, so both objects share the same data

The data behind the pointer is not duplicated; both objects point to one block.

Can you get the rest right without peeking?

Take the timed Quiz: Copy Constructor and Deep Copy quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →