🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: C++ Interview Questions: all 10 questions

Quiz: C++ Interview Questions · Question 10 of 10

What does delete do that free does not?

What does delete do that free does not?

  1. A.Nothing; they are the same
  2. B.It calls the object's destructor before releasing the memory
  3. C.It sets the pointer to nullptr
  4. D.It works only on arrays
Answer & explanation

Correct answer: It calls the object's destructor before releasing the memory

new/delete call constructors and destructors; malloc/free only manage raw bytes.

Can you get the rest right without peeking?

Take the timed Quiz: C++ Interview Questions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →