← 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?
- A.A copy that copies only the first member
- B.A copy where pointer members are copied as addresses, so both objects share the same data
- C.A copy made on the stack
- 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 →