Comp220 final exam 1 (100% correct answers)

Page 1

COMP220 Final Exam 1 (100% Correct Answers)

Download here: http://homeworkfox.com/questions/computer-science/11737/comp22


1. (TCO 1) Explain how to use loops to process the data stored in a two-dimensional array. In your explanation, include a two-dimensional array declaration and initialization. (Points : 10) 2. (TCO 2) Develop a class definition that models an employee. Include private and public member functions and variables. Demonstrate how the class would be instantiated and how class members would be accessed. (Points : 10) 3. (TCO 3) Using a personal computer as a base model, write a C++, syntactically correct class definition demonstrating composition. In the class definition, include at least the following threeitems that are common to a PC: a CD drive, a hard disk drive, and a power supply. You are not required to include any constructors, destructors, or additional member functions; you are only required to list the members that directly show composition and the proper access attributes. (Points : 10) 4. (TCO 4) If a class is derived protected from a base class, explain how this affects the inheritance of all the public, protected, and private members of the base class by the derived class. (Points : 10) 5. (TCO 5) Write all the code necessary to dynamically allocate an array of 10 double-precision, floatingpoint variables and then write the code that will deallocate the memory. Add comment fields to each line of code describing what it is and does. (Points : 10) 6. (TCO 6) Explain why the native operators defined in C++ will not work with classes unless they have been properly overloaded. (Points : 10) 7. (TCO 7) Explain what pure virtual functions are, what an abstract class is, and how they both relate to dynamic binding and polymorphism. (Points : 10) 8. (TCO 8) Why are comments and comment blocks important to programming? (Points : 10)


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.