iGET

Java Programming - MCQ Practice Questions

Practice free Java Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

958 questions | 100% Free

Q.41Easy

Which keyword is used to make a variable immutable in Java?

Q.42Easy

Which of the following access modifiers allows a variable to be accessed only within the same class?

Q.43Easy

In Java, which keyword is used to create a reference variable that cannot point to a different object after initialization?

Q.44Easy

What is the primary purpose of using the 'super' keyword in Java?

Q.45Easy

In Java OOP, which principle ensures that internal details of a class are hidden from the outside world?

Q.46Easy

Which of the following correctly describes the relationship between a class and an interface?

Q.47Easy

What will be the output of the following code? class Parent { void display() { System.out.println("Parent"); } } class Child extends Parent { void display() { System.out.println("Child"); } } public class Test { public static void main(String[] args) { Parent p = new Child(); p.display(); } }

Q.48Easy

What is the primary purpose of the 'super' keyword in Java?

Q.49Easy

Consider the code: class A { A() { System.out.println("A"); } } class B extends A { B() { super(); System.out.println("B"); } } What will be printed when 'new B()' is executed?

Q.50Easy

Which access modifier allows a member to be accessed only within the same class?

Q.51Easy

Which concept best describes the relationship between Parent and Child classes in 'class Child extends Parent'?

Q.52Easy

Which of the following correctly describes encapsulation?

Q.53Easy

What happens when you try to instantiate an interface in Java?

Q.54Easy

Which keyword is used to achieve runtime polymorphism in Java?

Q.55Easy

Can a class extend multiple classes in Java?

Q.56Easy

What is the access modifier of members declared in an interface?

Q.57Easy

What is the default access modifier for class members in Java if not explicitly specified?

Q.58Easy

Which keyword is used to prevent a class from being subclassed?

Q.59Easy

Can you instantiate an interface in Java?

Q.60Easy

What is the default access modifier for a class member in Java if no modifier is specified?