Chapter 10: Review QuestionsΒΆ

1. The header file associated with the definition of a
   class is usually referred to as the

   a.   header file
   b.   implementation file
   c.   interface file
   d.   definition file

2. Those class members defined as ____________ are
   accessible only to member functions of the class and
   friends of the class.

   a. public
   b. private
   c. friend
   d. virtual

3. When an instance of a class is declared, the
   ____________ of the class is automatically called.

   a. constructor
   b. destructor
   c. mutator
   d. accessor

4. The default access for members of a class is

   a. public
   b. private
   c. protected
   d. virtual

5. Class definitions typically contain function
   definitions for functions that allow the user of the
   class to set a value into a class data member.  These
   types of function are usually classified as

   a. operator overload functions.
   b. mutator functions.
   c. accessor functions.
   d. function overload functions.

6. Data members of a class should, in most cases, be
   placed in the ______________ section of the class
   definition.

   a. private
   b. protected
   c. public
   d. virtual

7. Class definitions typically contain function
   definitions for functions that allow the user of the
   class to get a value from a class data member.  These
   types of function are usually classified as

   a. operator overload functions.
   b. mutator functions.
   c. accessor functions.
   d. function overload functions.

8. The implementation of a class is supposed to be hidden
   from the user of the class.  This hiding of the     implementation is called

   a. data hiding
   b. private methods
   c. public interface
   d. encapsulation

9. Find the error(s) in each of the following and explain
   how to correct it.

   a. Given the following prototype in class CDate.

        void ~CDate( int );

        ERROR: ________________________________________________

             __________________________________________________

        CORRECTION: ___________________________________________

             __________________________________________________

   b. Given the following class definition for CDate:

        class CDate
        {
        public:
             ...
        private:
             int month = 0, day = 0, year = 0;
             ...
        };

        ERROR:_________________________________________________

             __________________________________________________

        CORRECTION: ___________________________________________

             __________________________________________________

             __________________________________________________

   c. Given the following prototype in class CDate:

        int CDate( int mon, int dy, int yr );

        ERROR:_________________________________________________

        _______________________________________________________

        CORRECTION:____________________________________________

        _______________________________________________________

Previous topic

Chapter 10: Programming Exercises

Next topic

Chapter 11 Operators as Functions

This Page