

MCQOPTIONS
Saved Bookmarks
This section includes 16 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 allows to secure the public members of base class in inherited classes? |
A. | Private |
B. | Protected |
C. | Public |
D. | Private and Protected |
Answer» E. | |
2. |
In multi-level inheritance(all public), the public members of parent/superclass will ________ |
A. | Will continue to get inherited subsequently |
B. | Will not be inherited after one subclass inheritance |
C. | , the public members of parent/superclass will ________a) Will continue to get inherited subsequentlyb) Will not be inherited after one subclass inheritancec) Will not be available to be called outside class |
D. | Will not be able to allocated with any memory space |
Answer» B. Will not be inherited after one subclass inheritance | |
3. |
If a class doesn’t have public members, then________ |
A. | None of its members will be able to get inherited |
B. | None of its instance creation will be allowed |
C. | None of its member function can be called outside the class |
D. | None of its data members will be able to get initial value |
Answer» D. None of its data members will be able to get initial value | |
4. |
Which among the following is true for public class? |
A. | There can be more than one public class in a single program |
B. | Public class members can be used without using instance of class |
C. | Public class is available only within the package |
D. | Public classes can be accessed from any other class using instance |
Answer» E. | |
5. |
Which specifier can be used to inherit protected members as protected in subclass but public as public in subclass? |
A. | Private |
B. | Default |
C. | Public |
D. | Protected |
Answer» D. Protected | |
6. |
A class has its default constructor defined as public. Class B inherits class A privately. The class ___________ |
A. | B will not be able to have instances |
B. | Only A can have instances |
C. | Only B can have instances |
D. | Both classes can have instances |
Answer» E. | |
7. |
Which among the following for public specifier is false? |
A. | The static members can’t be public |
B. | The public members are available in other packages too |
C. | The subclasses can inherit the public members privately |
D. | There can be only one public class in java program |
Answer» B. The public members are available in other packages too | |
8. |
How many public class(s) (outermost) can be there in a java program? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | As required |
Answer» B. 2 | |
9. |
If members of a super class are public, then________ |
A. | All those will be available in subclasses |
B. | None of those will be available in subclasses |
C. | Only data members will be available in subclass |
D. | Only member functions will be available in subclass |
Answer» B. None of those will be available in subclasses | |
10. |
We can reduce the visibility of inherited methods. |
A. | True |
B. | False |
Answer» C. | |
11. |
Which among the following can be used for outermost class access specifier in java? |
A. | Private |
B. | Public |
C. | Default |
D. | Default or Public |
Answer» E. | |
12. |
Which among the following have least security according to the access permissions allowed? |
A. | Private |
B. | Default |
C. | Protected |
D. | Public |
Answer» E. | |
13. |
If the members have to be accessed from anywhere in the program and other packages also, which access specifier should be used? |
A. | Public |
B. | Private |
C. | Protected |
D. | Default |
Answer» B. Private | |
14. |
Which among the following for public specifier is false?$ |
A. | The static members can’t be public |
B. | The public members are available in other packages too |
C. | The subclasses can inherit the public members privately |
D. | There can be only one public class in java program |
Answer» D. There can be only one public class in java program | |
15. |
If a class doesn’t have public members, then________$ |
A. | None of its members will be able to get inherited |
B. | None of its instance creation will be allowed |
C. | None of its member function can be called outside the class |
D. | None of its data members will be able to get initial value |
Answer» E. | |
16. |
Only object of class A can access disp() function |
A. | Only object of class B can access disp() function |
B. | Both instances can access disp() function |
C. | Accessing disp() outside class is not possible |
Answer» B. Both instances can access disp() function | |