--:--









Quiz for Virtual destructors

Course: C++ Language | Subject: Unit 7 | Topic: Polymorphism



Logo

Q1: Why should destructors be declared virtual in base classes?

Logo

Q2: What happens if a base class destructor is not virtual?

Logo

Q3: Can a destructor be both virtual and pure virtual?

Logo

Q4: Why is it important to declare the destructor virtual in a polymorphic base class?

Logo

Q5: What is a polymorphic base class?

Logo

Q6: When should you declare a virtual destructor?

Logo

Q7: What does a virtual destructor ensure?

Logo

Q8: Can a class have a virtual destructor but no other virtual functions?

Logo

Q9: What keyword is used to declare a virtual destructor?

Logo

Q10: What happens if a derived class destructor is not explicitly defined?

Logo

Q11: Are destructors inherited?

Logo

Q12: What happens if you delete a derived object through a base pointer without a virtual destructor?

Logo

Q13: Can a virtual destructor have a definition outside the class?

Logo

Q14: Is it mandatory to declare destructor virtual in classes not intended for inheritance?

Logo

Q15: What is the effect of declaring a destructor pure virtual?

Logo

Q16: Which of these is true about virtual destructors?

Logo

Q17: Does virtual destructor affect object size?

Logo

Q18: Which of these statements is correct?

Logo

Q19: What happens if virtual destructor is missing but base class pointer deletes derived object?

Logo

Q20: Which of the following best practices is recommended?

Are you ready to start test? Set your time limit