Home > Object Oriented Programming > Quizzes > Object Oriented Programming Practice Test: Access Specifiers
Object Oriented Programming Practice Test: Access Specifiers
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 74% Most missed: “Which specifier can be used to inherit protected members as protected in subclas…”
Quiz on access specifiers, private, public and protected access Specifiers. Access specifiers are keywords in object-oriented programming languages that set the accessibility of classes, methods, and other members. They allow us to determine which class members are accessible to other classes and functions, and which are not. There are three types of access specifiers in C++: Public: Public members are accessible from anywhere in the program. Private: Private members are only accessible from within the class in which they are declared. Protected: Protected members are accessible from... Show more
Object Oriented Programming Practice Test: Access Specifiers
Time left 00:00
25 Questions

1. Which specifier should be used for member functions of a class?
2. Which among the following is true?
3. If protected inheritance is used then _____
4. 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?
5. If a constructor is defined in protected access, then?
6. If a class has all the private members, which specifier will be used for its implicit constructor?
7. Which among the following is correct to call a private member from outside the class?
8. How many public class(s) (outermost) can be there in a java program?
9. Which among the following have least security according to the access permissions allowed?
10. Which among the following for public specifier is false?
11. 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?
12. Which among the following can be used for outermost class access specifier in java?
13. We can reduce the visibility of inherited methods.
14. Which specifier allows a programmer to make the private members which can be inherited?
15. If members of a super class are public, then________
16. If the members have to be accessed from anywhere in the program and other packages also, which access specifier should be used?
17. Which access specifier is usually used for data members of a class?
18. Which specifier allows to secure the public members of base class in inherited classes?
19. Which among the following can use protected access specifier?
20. Which access specifier should be used so that all the parent class members can be inherited and accessed from outside the class?
21. On which specifier’s data, does the size of a class’s object depend?
22. Private member functions can be overloaded.
23. Protected members differ from default members as _______
24. If protected members are to be accessed from outside the class then__________
25. If private members have to be accessed directly from outside the class but the access specifier must not be changed, what should be done?