Exercise: Objects And Classes

Questions for: Objects And Classes

Which of the following access specifies is used in a class definition by default?
A:
Protected
B:
Public
C:
Private
D:
Friend
Answer: C
No answer description is available. Let's discuss.
Which of the following statements is correct about the constructors and destructors?
A:
Destructors can take arguments but constructors cannot.
B:
Constructors can take arguments but destructors cannot.
C:
Destructors can be overloaded but constructors cannot be overloaded.
D:
Constructors and destructors can both return a value.
Answer: B
No answer description is available. Let's discuss.
Which of the following statements is correct when a class is inherited publicly?
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 protected members of derived class.
D:
Public members of the base class become public members of derived class.
Answer: D
No answer description is available. Let's discuss.
How can we make a class abstract?
A:
By making all member functions constant.
B:
By making at least one member function as pure virtual function.
C:
By declaring it abstract using the static keyword.
D:
By declaring it abstract using the virtual keyword.
Answer: B
No answer description is available. Let's discuss.
Which of the following two entities (reading from Left to Right) can be connected by the dot operator?
A:
A class member and a class object.
B:
A class object and a class.
C:
A class and a member of that class.
D:
A class object and a member of that class.
Answer: D
No answer description is available. Let's discuss.
Ad Slot (Above Pagination)
Quiz