Final Exam, CSCI 330, Spring 2021


  1. Hierarchies
    1. [2 points] What relationship does a hierarchy model?
    2. [3 points] Given the relationship modeled by a hierarchy, describe why a member is added to the base class.
    3. [3 points] Given the relationship modeled by a hierarchy, describe why a member is added to a derived class.
    4. [2 points] What is the purpose of the c++ keyword override in a hierarchy?
  2. Virtual Functions
    1. [2 points] Why would a programmer declare a function to be virtual?
    2. [2 points] What is a pure virtual function?
    3. [2 points] How would a programmer declare a pure virtual function?
    4. [2 points] Why would a programmer declare a pure virtual function?
    5. [2 points] What member function should always be declared virtual?
  3. Polymorphism
    1. [4 points] What does it mean for a set of objects to be polymorphic?
    2. [2 points] How do you make a hierarchy polymorphic in c++?
    3. [2 points] What is the purpose of the reinterpret_cast in c++?
    4. [2 points] What is the behavior of the reinterpret_cast in c++?
  4. Multiple Inheritance
    1. [4 points] What is the diamond problem and when does it occur?
    2. [4 points] What issues are caused by the diamond problem?
    3. [2 points] How does c++ overcome issues caused by the diamond problem?
  5. Misc
    1. [3 points] Why would a programmer create a templated class?
    2. [3 points] Give a case where member data must be initialized using a ctor initializer.
    3. [4 points] What is the difference between new and malloc?

Submission Instructions