C++ Final GRADE A QUESTIONS WITH ANSWER
Which of the following is true about inheritance?
Select one:
a.
All public member functions of the base class become the public member functions of
the derived class.
b.
All public member variables of the base class become the public member variables 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 members of the base class become the public members of the derived class. -
(correct answer)The public member variables of the base class become the public or
private member variables of the derived class.
Suppose that bClass is a class. Which of the following statements correctly derives the
class dClass from bClass?
Select one:
a.
class dClass:: protected bClass
{
//classMembersList
};
b.
class dClass: private bClass
{
//classMembersList
,};
c.
class bClass: public dClass
{
//classMembersList
};
d.
class dClass:: public bClass
{
//classMembersList
}; - (correct answer)class dClass: private bClass
{
//classMembersList
};
A call to the base class's constructor is specified in the heading of the definition of a
derived class constructor.
Select one:
True
False - (correct answer)True
The ____ members of an object form its internal state.
Select one:
a.static
b.protected
c.private
d.public - (correct answer)private
,Inheritance is an example of a(n) ____ relationship.
Select one:
a.has-a
b.handshaking
c.is-a
d.had-a - (correct answer)is-a
The private members of a base class can be directly accessed by a derived class.
Select one:
True
False - (correct answer)False
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.
Select one:
a.
rename
b.
redefine
c.
reuse
d.
overload - (correct answer)redefine
____ is the ability to use the same expression to denote different operations.
Select one:
, a.
Inheritance
b.
Encapsulation
c.
Composition
d.
Polymorphism - (correct answer)polymorphism
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.
Select one:
a.
overloaded
b.
reused
c.
redefined
d.
overridden - (correct answer)overloaded
If the derived class does not override a public member function of the base class, you
may specify a call to that public member function by using the name of the function and
the appropriate parameter list.
Select one:
True
False - (correct answer)True
Which of the following is true about inheritance?
Select one:
a.
All public member functions of the base class become the public member functions of
the derived class.
b.
All public member variables of the base class become the public member variables 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 members of the base class become the public members of the derived class. -
(correct answer)The public member variables of the base class become the public or
private member variables of the derived class.
Suppose that bClass is a class. Which of the following statements correctly derives the
class dClass from bClass?
Select one:
a.
class dClass:: protected bClass
{
//classMembersList
};
b.
class dClass: private bClass
{
//classMembersList
,};
c.
class bClass: public dClass
{
//classMembersList
};
d.
class dClass:: public bClass
{
//classMembersList
}; - (correct answer)class dClass: private bClass
{
//classMembersList
};
A call to the base class's constructor is specified in the heading of the definition of a
derived class constructor.
Select one:
True
False - (correct answer)True
The ____ members of an object form its internal state.
Select one:
a.static
b.protected
c.private
d.public - (correct answer)private
,Inheritance is an example of a(n) ____ relationship.
Select one:
a.has-a
b.handshaking
c.is-a
d.had-a - (correct answer)is-a
The private members of a base class can be directly accessed by a derived class.
Select one:
True
False - (correct answer)False
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.
Select one:
a.
rename
b.
redefine
c.
reuse
d.
overload - (correct answer)redefine
____ is the ability to use the same expression to denote different operations.
Select one:
, a.
Inheritance
b.
Encapsulation
c.
Composition
d.
Polymorphism - (correct answer)polymorphism
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.
Select one:
a.
overloaded
b.
reused
c.
redefined
d.
overridden - (correct answer)overloaded
If the derived class does not override a public member function of the base class, you
may specify a call to that public member function by using the name of the function and
the appropriate parameter list.
Select one:
True
False - (correct answer)True