

MCQOPTIONS
Saved Bookmarks
This section includes 20 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
Which specifier should be used for member functions of a class? |
A. | Private |
B. | Default |
C. | Protected |
D. | Public |
Answer» E. | |
2. |
Which access specifier is usually used for data members of a class? |
A. | Private |
B. | Default |
C. | Protected |
D. | Public |
Answer» B. Default | |
3. |
Which access specifier should be used so that all the parent class members can be inherited and accessed from outside the class? |
A. | Private |
B. | Default or public |
C. | Protected or private |
D. | Public |
Answer» E. | |
4. |
If an abstract class has all the private members, then _________ |
A. | No class will be able to implement members of abstract class |
B. | Only single inheritance class can implement its members |
C. | Only other enclosing classes will be able to implement those members |
D. | No class will be able to access those members but can implement. |
Answer» B. Only single inheritance class can implement its members | |
5. |
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? |
A. | Yes, because friend function can access all the members |
B. | Yes, because friend function is of class B |
C. | No, because friend function can only access private members of friend class |
D. | No, because friend function can access private member of class A also |
Answer» D. No, because friend function can access private member of class A also | |
6. |
On which specifier’s data, does the size of a class’s object depend? |
A. | All the data members are added |
B. | Only private members are added |
C. | Only public members are added |
D. | Only default data members are added |
Answer» B. Only private members are added | |
7. |
Which access specifier should be used in a class where the instances can’t be created? |
A. | Private default constructor |
B. | All private constructors |
C. | Only default constructor to be public |
D. | Only default constructor to be protected |
Answer» C. Only default constructor to be public | |
8. |
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 the object of class B. |
A. | Any function of class A |
B. | The add() function of class A |
C. | Any member of class A |
D. | Private, protected and public members of class A |
Answer» E. | |
9. |
If a class has all the private members, which specifier will be used for its implicit constructor? |
A. | Private |
B. | Public |
C. | Protected |
D. | Default |
Answer» C. Protected | |
10. |
Which among the following is false? |
A. | Private members can be accessed using friend functions |
B. | Member functions can be made private |
C. | Default members can’t be inherited |
D. | Public members are accessible from other classes also |
Answer» D. Public members are accessible from other classes also | |
11. |
Which specifier allows a programmer to make the private members which can be inherited? |
A. | Private |
B. | Default |
C. | Protected |
D. | Protected and default |
Answer» D. Protected and default | |
12. |
Which access specifier is used when no access specifier is used with a member of class (java)? |
A. | Private |
B. | Default |
C. | Protected |
D. | Public |
Answer» C. Protected | |
13. |
Which among the following can restrict class members to get inherited? |
A. | Private |
B. | Protected |
C. | Public |
D. | All three |
Answer» B. Protected | |
14. |
Which among the following can be used together in a single class? |
A. | Only private |
B. | Private and Protected together |
C. | Private and Public together |
D. | All three together |
Answer» E. | |
15. |
How many types of access specifiers are provided in OOP (C++)? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» D. 4 | |
16. |
ON_WHICH_SPECIFIER‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚ÀÖ¬•S_DATA,_DOES_THE_SIZE_OF_A_CLASS‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚ÀÖ¬•S_OBJECT_DEPEND??$# |
A. | All the data members are added |
B. | Only private members are added |
C. | Only public members are added |
D. | Only default data members are added |
Answer» B. Only private members are added | |
17. |
WHICH_ACCESS_SPECIFIER_SHOULD_BE_USED_IN_A_CLASS_WHERE_THE_INSTANCES_CAN‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚ÀÖ¬•T_BE_CREATED??$# |
A. | Private default constructor |
B. | All private constructors |
C. | Only default constructor to be public |
D. | Only default constructor to be protected |
Answer» C. Only default constructor to be public | |
18. |
If an abstract class has all the private members, then _________$ |
A. | No class will be able to implement members of abstract class |
B. | Only single inheritance class can implement its members |
C. | Only other enclosing classes will be able to implement those members |
D. | No class will be able to access those members but can implement. |
Answer» B. Only single inheritance class can implement its members | |
19. |
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?$ |
A. | Yes, because friend function can access all the members |
B. | Yes, because friend function is of class B |
C. | No, because friend function can only access private members of friend class |
D. | No, because friend function can access private member of class A also |
Answer» D. No, because friend function can access private member of class A also | |
20. |
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? |
A. | Any function of class A |
B. | The add() function of class A |
C. | Any member of class A |
D. | Private, protected and public members of class A |
Answer» E. | |