Exercise: Objects And Classes

Questions for: Objects And Classes

Which of the following statements is correct when a class is inherited privately?
A:
Public members of the base class become protected members of derived class.
B:
Public members of the base class become private members of derived class.
C:
Private members of the base class become private members of derived class.
D:
Public members of the base class become public members of derived class.
Answer: B
No answer description is available. Let's discuss.
What does the class definitions in following code represent?
class Bike
{
    Engine objEng;
};
class Engine
{
    float CC;
};
A:
kind of relationship
B:
has a relationship
C:
Inheritance
D:
Both A and B
Answer: B
No answer description is available. Let's discuss.
How many objects can be created from an abstract class?
A:
Zero
B:
One
C:
Two
D:
As many as we want
Answer: A
No answer description is available. Let's discuss.
Which of the following statements about virtual base classes is correct?
A:
It is used to provide multiple inheritance.
B:
It is used to avoid multiple copies of base class in derived class.
C:
It is used to allow multiple copies of base class in a derived class.
D:
It allows private members of the base class to be inherited in the derived class.
Answer: B
No answer description is available. Let's discuss.
Constructor is executed when _____.
A:
an object is created
B:
an object is used
C:
a class is declared
D:
an object goes out of scope.
Answer: A
No answer description is available. Let's discuss.
Ad Slot (Above Pagination)
Quiz