Final Exam, CSCI 330, Spring 2021
- You may use books, notes and other non-human references. You may not interact with any other person when answering these questions.
- Please answer each question thoughtfully and carefully. I expect your answers to demonstration participation in this class.
- The weight for each question is given.
- Please use a word processor to answer the questions.
- Please answer the questions in black.
- Do not use red, anything in red was written by the instructor.
- If you wish, you may answer any coding questions using a text editor.
- Place all answers in a single file.
- Label each answer clearly with the question number.
- Proper use of terminology will be graded.
- The test is due at the end of class.
- Submission instructions are at the end of the test.
- Submissions should be done through the D2L assignment folder Final Exam
- If you have problems submitting the test, please contact your instructor.
- If you miss the dropbox deadline, email your solution to your instructor.
- If you have questions, please communicate with your instructor via email.
- Hierarchies
- [2 points] What relationship does a hierarchy model?
- [3 points] Given the relationship modeled by a hierarchy, describe why a member is added to the base class.
- [3 points] Given the relationship modeled by a hierarchy, describe why a member is added to a derived class.
- [2 points] What is the purpose of the c++ keyword
override
in a hierarchy?
- Virtual Functions
- [2 points] Why would a programmer declare a function to be
virtual
?
- [2 points] What is a pure virtual function?
- [2 points] How would a programmer declare a pure virtual function?
- [2 points] Why would a programmer declare a pure virtual function?
- [2 points] What member function should always be declared virtual?
- Polymorphism
- [4 points] What does it mean for a set of objects to be polymorphic?
- [2 points] How do you make a hierarchy polymorphic in c++?
- [2 points] What is the purpose of the reinterpret_cast in c++?
- [2 points] What is the behavior of the reinterpret_cast in c++?
- Multiple Inheritance
- [4 points] What is the diamond problem and when does it occur?
- [4 points] What issues are caused by the diamond problem?
- [2 points] How does c++ overcome issues caused by the diamond problem?
- Misc
- [3 points] Why would a programmer create a templated class?
- [3 points] Give a case where member data must be initialized using a ctor initializer.
- [4 points] What is the difference between
new
and malloc
?
Submission Instructions
- Submit your test and the source code for the program to the D2L assignment folder Final by 10:00
- If you miss this deadline, you can submit your test by email to dbennett@edinboro.edu. Depending on the circumstances, there may be a 5% penalty per minute applied for email submissions.