Question: QUESTION 6 The new classes that we create from existing classes are called ____ classes. a. sibling b. parent c. derived d. base 1 points
QUESTION 6
The new classes that we create from existing classes are called ____ classes.
| a. | sibling | |
| b. | parent | |
| c. | derived | |
| d. | base |
1 points
QUESTION 7
Classes can create new classes from existing classes. This important feature ____.
| a. | results in more software complexity | |
| b. | provides public access to the internal state of an object | |
| c. | aids the separation of data and operations | |
| d. | encourages code reuse |
1 points
QUESTION 8
Which of the following is true about inheritance?
| a. | All public member functions of the base class become the public member functions of the derived class. | |
| b. | All public members of the base class become the public members of the derived class. | |
| c. | The public member variables of the base class become the public or private member variables of the derived class. | |
| d. | All public member variables of the base class become the public member variables of the derived class. |
1 points
QUESTION 9
The ____ members of an object form its external state.
| a. | protected | |
| b. | private | |
| c. | static | |
| d. | public |
1 points
QUESTION 10
Inheritance is an example of a(n) ____ relationship.
| a. | handshaking | |
| b. | is-a | |
| c. | has-a | |
| d. | had-a |
1 points
QUESTION 11
Existing classes, from which you create new classes, are called ____ classes.
| a. | base | |
| b. | derived | |
| c. | child | |
| d. | sibling |
1 points
QUESTION 12
Consider the following class definitions: class bClass { public: void setX(int a); //Postcondition: x = a; void print() const; private: int x; }; class dClass: public bClass { public: void setXY(int a, int b); //Postcondition: x = a; y = b; void print() const; private: int y; }; Which of the following correctly sets the values of x and y?
| a. | void dClass::setXY(int a, int b) { x = bClass.setX(a); b = y; } | |
| b. | void dClass::setXY(int a, int b) { x = bClass::setX(a); y = bClass::setY(b); } | |
| c. | void dClass::setXY(int a, int b) { x = a; y = b; } | |
| d. | void dClass::setXY(int a, int b) { bClass::setX(a); y = b; } |
1 points
QUESTION 13
____ is a has-a relationship.
| a. | Inheritance | |
| b. | Polymorphism | |
| c. | Encapsulation | |
| d. | Composition |
1 points
QUESTION 14
If the corresponding functions in the base class and the derived class have the same name but different sets of parameters, then this function is ____ in the derived class.
| a. | redefined | |
| b. | reused | |
| c. | overridden | |
| d. | overloaded |
1 points
QUESTION 15
Which of the following is a valid definition of the derived class bClass?
| a. | class bClass::aClass { //... } | |
| b. | class bClass: public aClass { //... }; | |
| c. | class aClass::bClass { //... }; | |
| d. | class aClass: public bClass { //... }; |
1 points
QUESTION 16
To ____ a public member function of a base class in the derived class, the corresponding function in the derived class must have the same name, number, and types of parameters.
| a. | rename | |
| b. | reuse | |
| c. | redefine | |
| d. | overload |
1 points
QUESTION 17
OOP implements ____.
| a. | IPE | |
| b. | EIP | |
| c. | UML | |
| d. | OOD |
1 points
QUESTION 18
The ____ members of an object form its internal state.
| a. | public | |
| b. | protected | |
| c. | private | |
| d. | static |
1 points
QUESTION 19
Which of the following statements about inheritance is true if memberAccessSpecifier is protected?
| a. | The protected members of the base class become private members of the derived class. | |
| b. | The derived class can directly access any member of the base class. | |
| c. | The public members of the base class become protected members of the derived class. | |
| d. | The private members of the base class become protected members of the derived class. |
1 points
QUESTION 20
C++ provides ____ functions as a means to implement polymorphism in an inheritance hierarchy, which allows the run-time selection of appropriate member functions.
| a. | overloaded | |
| b. | redefined | |
| c. | virtual | |
| d. | overridden |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
