Access Specifiers Mcqs

Our collections of Multiple choice questions and answers focuses on study of Access Specifiers in OOP. These questions are chosen from a collection of most authoritative and best reference books on OOP. Our aim is to prepare an individual for competitive exams like NTS, Web Developer | IOS Developer | Game Developer | Software House interviews and jobs, University and College entrance exams and various tests and job interviews. One should practice our Mcqs to assimilate Access Specifiers in OOP comprehensively.

7.
If class A has add() function with protected access, and few other members in public . Then class B inherits class A privately. Will the user will not be able to call _________ from object of class B.

Any function of class A

The add() function of class A

Any member of class A

Private, protected and public members of class A

8.
Which access specifier should be used in a class where the instances can’t be created?

Private default constructor

All private constructors

Only default constructor to be public

Only default constructor to be protected

9.
On which specifier’s data, does the size of a class’s object depend?

All the data members are added

Only private members are added

Only public members are added

Only default data members are added

10.
If class B inherits class A privately. And class B has a friend function. Will the friend function be able to access the private member of class A?

Yes, because friend function can access all the members

Yes, because friend function is of class B

No, because friend function can only access private members of friend class

No, because friend function can access private member of class A also

11.
If an abstract class has all the private members, then _________

No class will be able to implement members of abstract class

Only single inheritance class can implement its members

Only other enclosing classes will be able to implement those members

No class will be able to access those members but can implement.

12.
Which access specifier should be used so that all the parent class members can be inherited and accessed from outside the class?

Private

Default or public

Protected or private

Public

15.
If a function has to be called only by using other member functions of the class, what should be the access specifier used for that function?

Private

Protected

Public

Default

0Shares
0
Scroll to Top