iGET

Java Programming - MCQ Practice Questions

Java interviews and campus tests lean heavily on object oriented behaviour rather than API recall. This set covers inheritance and polymorphism, interfaces and abstract classes, the collections framework, exception handling, multithreading, string handling, and JVM basics such as garbage collection. Output based questions are included because they expose the gaps that theory questions hide.

951 questions | 100% Free

Q.81Easy

What is the primary purpose of the Comparator interface in Collections Framework?

Q.82Easy

Which interface in Java Collections Framework is used to maintain insertion order while allowing duplicates?

Q.83Easy

What is the time complexity of get() operation in HashMap in average case?

Q.84Easy

Which collection class is synchronized and thread-safe by default?

Q.85Easy

What does the PriorityQueue in Java Collections Framework guarantee?

Q.86Easy

Consider: List<String> list = new ArrayList<>(); list.add("Java"); list.add("Python"); What will list.get(1) return?

Q.87Easy

Which method returns true if the map contains the specified value?

Q.88Easy

Which of the following collections maintains insertion order while allowing fast random access?

Q.89Easy

What will be the output of the following code? Set<Integer> set = new TreeSet<>(); set.add(5); set.add(2); set.add(8); set.add(2); System.out.println(set.size());

Q.90Easy

What will happen when you execute: Map<String, String> map = new HashMap<>(); map.put("key", null); System.out.println(map.get("key"));

Q.91Easy

Which interface must be implemented to create a thread in Java?

Q.92Easy

Which method is used to stop a thread in Java?

Q.93Easy

Which method is called to make a thread wait until another thread completes?

Q.94Easy

Which of the following is a valid way to create a thread in Java?

Q.95Easy

In Java multithreading, which method is used to pause the execution of a thread for a specified number of milliseconds without releasing locks?

Q.96Easy

Which of the following statements about the notify() method is correct?

Q.97Easy

Which exception is thrown when a thread is interrupted while waiting?

Q.98Easy

What is the return type of the join() method in Java threading?

Q.99Easy

Which of the following best describes the purpose of the Runnable interface in Java?

Q.100Easy

Which of the following statements about Java threads is correct?