← All topics
Quiz: Copy Constructor and Deep Copy: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. Which function runs for Student b = a; when b is being declared?
- Q2. What does this print? (code)
- Q3. What is a shallow copy?
- Q4. Why is a shallow copy dangerous for a class whose destructor does delete[] data?
- Q5. Why must the copy constructor take its parameter by reference?
- Q6. What does the rule of three say?
- Q7. What does this print? (code)
- Q8. In copy-and-swap, why does operator= take its parameter by value?
- Q9. How do you make a class impossible to copy?
- Q10. What is the rule of zero?