Class 10 Practice 6
Class 10 Practice 6
a) An access modifier controls the visibility of variables, constants and methods of a class
b) An access modifier can hide or show a variable or method to outside classes.
c) Access modifiers help in implementing the Encapsulation feature of OOPs.
d) All the above
2) Which is the keyword used to specify the DEFAULT access modifier in java?
a) default
b) auto
c) normal
d) There is no keyword
7) Which of these is used to access a member of class before object of that class is created?
a) public
b) private
c) static
d) protected
8) Which of these is used as a default for a member of a class if no access specifier is used for it?
a) private
b) public
c) public, within its own package
d) protected
9) What is the process by which we can control what parts of a program can access the
members of a class?
a) Polymorphism
b) Abstraction
c) Encapsulation
d) Recursion
11) Which of these access specifier must be used so that it can be inherited by another subclass?
a) public
b) private
c) protected
d) none of the mentioned
15) Can you access a default member of a class from a class outside the current package?
a) No
b) Yes
17) To access a protected variable or method of a Class outside the package, you need to.
a) Create an instance and call the protected variable or method
b) Create a Subclass and call the protected variable or method
c) A and B
d) None of the above
18) Choose the correct Java code snippet with access modifiers below?
a) class ABC { }
b) private protected class ABC { }
c) protected public class ABC { }
d) protected private class ABC { }
19) Visible in the classes and subclasses in the same package and subclasses in other packages.
a) private
b) public
c) protected
d) default
20) The ________ access specifier used in a class cannot be accessed by subclass in the same
package.
a) private
b) public
c) protected
d) default