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.1Easy

Which of the following is NOT a pillar of Object-Oriented Programming?

Q.2Easy

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

Q.3Easy

What will be the output? class Parent { void show() { System.out.println("Parent"); } } class Child extends Parent { void show() { System.out.println("Child"); } } parent obj = new Child(); obj.show();

Q.4Easy

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

Q.5Easy

Which interface in Java represents a collection that does not allow duplicate elements?

Q.6Easy

Which of the following correctly describes the 'this' keyword?

Q.7Easy

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

Q.8Easy

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

Q.9Easy

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

Q.10Easy

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

Q.11Easy

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

Q.12Easy

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

Q.13Easy

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.14Easy

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

Q.15Easy

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.16Easy

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

Q.17Easy

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

Q.18Easy

Which of the following correctly describes encapsulation?

Q.19Easy

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

Q.20Easy

Which keyword is used to achieve runtime polymorphism in Java?