Question 1 of 25
Hints left: 3
Q1
What will be the output of the following Java code snippet? enum Enums { A, B, C; private Enums() { System.out.println(10); } } public class MainClass { public static void main(String[] args) { Enum en = Enums.B; } }
Q2
Which keyword is used to explicitly specify that a method cannot be overridden in a subclass?
Q3
What is the default access modifier for class members in Java if no access modifier is specified?
Q4
Which of the following access modifiers allows access to a class member from any class in any package?
Q5
What is the keyword used to declare a class that cannot be instantiated and can only be extended?
Q6
Which of the following is not an access modifier in Java?
Q7
In Java, what is the purpose of the static keyword when applied to a variable?
Q8
Which of the following access modifiers restricts a method or variable's access to the same package only?
Q9
What keyword is used to declare a method that is implemented in a subclass to provide a specific implementation?
Q10
In Java, which access modifier allows a class member to be accessed from anywhere in the code?
Q11
What is the limitation of toString() method of BigDecimal?
Q12
What is the access level of a class member with no access modifier specified in Java?
Q13
What access modifier allows a class member to be accessed from any class in the same package or any subclass?
Q14
What is the default access modifier for a class in Java if no access modifier is specified?
Q15
In Java, which access modifier allows a method or variable to be accessed within the same package only?
Q16
Which keyword is used to define a superclass's method that is overridden by a subclass method?
Q17
In Java, which access modifier allows a class member to be accessed from any class, even outside the package?
Q18
Which access modifier allows a class member to be accessed within the same package and its subclasses?
Q19
In Java, what access modifier is used to specify that a class member can be accessed only within its class?
Q20
Which access modifier restricts a class member's visibility only to the same class and its subclasses?
Q21
What keyword is used to declare a method that can be called without creating an instance of the class?
Q22
Which access modifier allows a class member to be accessed only within its own class and package?
Q23
What is the access level of a class member declared as private in Java?
Q24
What keyword is used to declare a constant in Java, which is implicitly final and static?
Q25
In Java, what is the purpose of the final keyword when applied to a method?