🎙 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 1 of 10

Which function runs for Student b = a; when b is being declared?

Which function runs for Student b = a; when b is being declared?

  1. A.Copy assignment operator
  2. B.Copy constructor
  3. C.Default constructor, then assignment
  4. D.Destructor
Answer & explanation

Correct answer: Copy constructor

b is a new object, so it is constructed — the = here is initialisation, not assignment.

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 →