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.81Medium

What is the relationship between an abstract class and an interface in Java 8+?

Q.82Medium

Which of the following is true about interface default methods?

Q.83Medium

Which of the following correctly demonstrates composition over inheritance?

Q.84Medium

Which of the following demonstrates proper method overloading in Java?

Q.85Medium

What will happen if you try to override a final method in a subclass?

Q.86Medium

In Java, which of the following is true about abstract classes?

Q.87Medium

What is the correct way to call a parent class constructor from a child class?

Q.88Medium

Which statement about Java interfaces is INCORRECT according to 2024 specifications?

Q.89Medium

Consider a class hierarchy: Animal -> Dog -> Puppy. A Puppy reference can access which of the following?

Q.90Medium

What is the output of this code? class Test { static int x = 10; public static void main(String[] args) { System.out.println(x++); } }

Q.91Medium

In Java, if a parent class has a method void display() and a child class overrides it as void display(int x), what is this called?

Q.92Medium

Consider a scenario where you have an interface Shape with a method calculateArea(). You implement this in classes Circle and Rectangle. Which OOP concept is being demonstrated?

Q.93Medium

What will be printed when this code executes? class A { int x = 5; } class B extends A { int x = 10; } public class Test { public static void main(String[] args) { A a = new B(); System.out.println(a.x); } }

Q.94Medium

Which of the following statements about 'this' keyword in Java is INCORRECT?

Q.95Medium

In Java, a class can implement multiple interfaces but can extend only one class. This design choice primarily supports which principle?

Q.96Medium

In Java, when you override a method from a parent class, which of the following is NOT a valid reason to use the @Override annotation?

Q.97Medium

Which method is used to remove an element from ArrayList while iterating?

Q.98Medium

What is the load factor in HashMap? What is its default value?

Q.99Medium

What is the time complexity of add() operation in TreeSet?

Q.100Medium

Which of the following is thread-safe?