--:--









Quiz for Virtual base classes and virtual functions

Course: C++ Language | Subject: Unit 6 | Topic: Inheritance



Logo

Q1: What is the main purpose of a virtual base class?

Logo

Q2: Which keyword is used to declare a virtual base class?

Logo

Q3: What problem does virtual inheritance solve?

Logo

Q4: How do virtual functions enable runtime polymorphism?

Logo

Q5: Which table is used by C++ to support virtual function calls?

Logo

Q6: When a virtual function is called through a base class pointer, which function is executed?

Logo

Q7: Can constructors be declared virtual?

Logo

Q8: What happens if a base class has a virtual destructor?

Logo

Q9: If a class contains a virtual function, what does it typically contain?

Logo

Q10: Can a virtual function be called from a constructor?

Logo

Q11: What is the diamond problem in multiple inheritance?

Logo

Q12: How does virtual inheritance address the diamond problem?

Logo

Q13: Which of the following is true about virtual base classes?

Logo

Q14: What keyword is used to override a virtual function explicitly in derived class?

Logo

Q15: Can a virtual function be pure virtual?

Logo

Q16: What happens if a pure virtual function has a body?

Logo

Q17: Which keyword prevents further overriding of a virtual function?

Logo

Q18: How do you declare a virtual destructor?

Logo

Q19: Which of the following is NOT true about virtual functions?

Logo

Q20: What is vptr?

Are you ready to start test? Set your time limit