Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1: A class object can be _____. That is, it can be created once, when t

ID: 3557696 • Letter: Q

Question

Question 1: A class object can be _____. That is, it can be created once, when the control reaches its declaration, and destroyed when the program terminates.

       static
       automatic
       local
       public









Question 2: When composition is used:        the host object is constructed first and then the member objects are placed into it.
       member objects are constructed first, in the order they appear in the host constructor's initializer list.
       member objects are constructed first, in the order they are declared in their own class.
       member objects are constructed last, in the order they are declared in the host's class.

Explanation / Answer

Question 1: A class object can be _____. That is, it can be created once, when the control reaches its declaration, and destroyed when the program terminates.

       static
       automatic
       local
       public

Question 2: When composition is used:

       the host object is constructed first and then the member objects are placed into it.
       member objects are constructed first, in the order they appear in the host constructor's initializer list.
       member objects are constructed first, in the order they are declared in their own class.
       member objects are constructed last, in the order they are declared in the host's class.

Question 3: The private members of a base class can

       never be accessed by a derived class.
       be directly and indirectly accessed by a derived class.
       be indirectly accessed by a derived class.
       be directly accessed by a derived class.

Question 4: To overload a member function of the base class

       the name of the function and the formal parameter list of the corresponding function in the derived class must be the same.
       the name of the function must be different and the formal parameter list of the corresponding function in the derived class must be the same.
       the name of the function and the formal parameter list of the corresponding function in the derived class must be different.
       the name of the function must be the same and the formal parameter list of the corresponding function in the derived class must be different.

Question 5: Which of the following is true about a derived class?

       A derived class can directly access any member variable of the base class.
       A derived class can redefine any public member function of the base class.
       A derived class can have at most one base class.
       A derived class can redefine any member function of the base class.

Question 6: Which of the following statements about inheritance is true if the memberAccessSpecifier is protected?

       The private members of the base class become protected members of the derived class.
       The derived class can directly access any member of the base class.
       The public members of the base class become protected members of the derived class.
       The protected members of the base class become private members of the derived class.

Question 7: Consider the following class definitions:

class bClass
{
public:
     void setX(int);
     void print() const;
private:
     int x;
};
class dClass: public bClass
{
public:
     void setXY(int, int);
     void print() const;
private:
     int y;
};

Which of the following statements correctly redefines the member function print of bClass?

       void dClass::print() const {dClass:print(); }
       void dClass::print() const { cout << endl; }
       void bClass::print() const { cout endl; }
       void dClass::print() const { bClass::print(); cout }

Question 8: Which one of the following statements is a correct example of inheritance?

       An automobile has an engine.
       An automobile is a Mustang.
       A Mustang is an automobile.
       An engine is part of an automobile.

Question 9: Which of the following relationships is not a correct example of inheritance?

       Parent to Children
       Aunt to Uncle
       Grandparent to Grandchild
       Father and Mother to Children

Question 10: In a multifile, object-oriented C++ project, which file contains the class definition?

       classname.cpp
       classname.h
       classname.def
       classname.hdr

Question 2: When composition is used:

       the host object is constructed first and then the member objects are placed into it.
       member objects are constructed first, in the order they appear in the host constructor's initializer list.
       member objects are constructed first, in the order they are declared in their own class.
       member objects are constructed last, in the order they are declared in the host's class.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote