- Selenium
- JMeter
- DevOps
- VERSION CTRL
- ONLINE QUIZ
- Number System MCQ - 1
- Number System MCQ - 2
- Number System MCQ - 3
- Simplification MCQ - 1
- Average MCQ - 1
- Simple Interest MCQ - 1
- Compound Interest - MCQ
- Percentage - MCQ
- Ratio and Proportion - MCQ
- Profit and Loss - MCQ
- Time, Speed, and Distance - MCQ
- Time, and Work - MCQ
- Boats and Streams - MCQ
- General Knowledge Quiz - Indian Polity
- General Knowledge Quiz - History
- General Knowledge Quiz - Geography
- GK Quiz - Indian Polity - 2
- GK Quiz - Banking and Finance
- GK Quiz - Economics
- GK Quiz- Merger and Acquisition
- GK Quiz- International Bodies
- English Grammar quiz-1
- English Grammar quiz-2
- S/W PROJECT MANAGEMENT
- PROTRACTOR
- Java -Tutorials
- MORE
Java MCQ test - Access Modifiers | Java Quiz on Access Modifiers
Check your Java concepts on access modifiers with our free online Java test series. Evaluate access modifiers concepts in Java by giving this online test that covers questions on - public, private, protected, final, static, and abstract modifiers.
Java access modifiers MCQ test
Topic- Java - Access Modifiers
The test consists of 11 questions.
No negative marking for this test.
No Time limit
The pass percentage is 70%
The correct answer with a description will be displayed after the answer has been marked.
Submit the test to calculate your score once you are done with all the questions.
Complexity Level- Moderate
Q1: A variable with the 'public' modifier can be accessed from anywhere, wherever this class is visible:
Select whether the statement is True or False.
Q2: Private members of a class can be inherited by the sub-class:
Select whether the statement is True or False.
Q3: Protected members in Java are accessible:
Select all possible answers:
Q4: A static method in a class can _______
Q5: If a variable of primitive datatype in Java is declared as final, then ______
Q6: Non-subclasses in other packages can also access protected members from other packages
Select whether the statement is true or false:
Q7: What will be the output of the below program:
class superDemoClass{
final int a = 20;
}
class subDemoClass extends superDemoClass{
void subFunc(){
a=40;
System.out.println("value of a = " +a);
}
}
class demo{
public static void main(String[] args){
subDemoClass subc = new subDemoClass();
subc.subFunc();
}
}
class superDemoClass{
final int a = 20;
}
class subDemoClass extends superDemoClass{
void subFunc(){
a=40;
System.out.println("value of a = " +a);
}
}
class demo{
public static void main(String[] args){
subDemoClass subc = new subDemoClass();
subc.subFunc();
}
}
Q8: If a method is declared as final in Java, then _________
Q9:What will be the output of the below program:
class superDemoClass{
final void func(){
int a = 20;
System.out.println("value of a = " +a);
}
}
class subDemoClass extends superDemoClass{
void func(){
int b = 60;
System.out.println("value of b = " +b);
}
}
class demo{
public static void main(String[] args){
subDemoClass subc = new subDemoClass();
subc.func();
}
}
class superDemoClass{
final void func(){
int a = 20;
System.out.println("value of a = " +a);
}
}
class subDemoClass extends superDemoClass{
void func(){
int b = 60;
System.out.println("value of b = " +b);
}
}
class demo{
public static void main(String[] args){
subDemoClass subc = new subDemoClass();
subc.func();
}
}
Q10: Which of the following statements is true for an abstract method in Java?
Q11: A final method cannot be abstract and vice versa.
Select whether the statement is True or False: