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

Which Collections utility method creates an immutable empty list?

Q.62Medium

In what scenario would you use a ConcurrentHashMap instead of HashMap?

Q.63Hard

What does the containsAll() method of Collection return for an empty collection?

Q.64Medium

Consider: Set<Integer> set = new HashSet<>(Arrays.asList(1,2,3,2,1)); System.out.println(set.size()); What is the output?

Q.65Medium

Which method in NavigableMap returns a view of the map in descending order?

Q.66Medium

What is the advantage of using LinkedList over ArrayList for frequent insertions at the beginning?

Q.67Hard

How does Java 8+ handle hash collisions in HashMap differently?

Q.68Hard

What is the behavior of WeakHashMap when a key is no longer strongly referenced?

Q.69Hard

Which of these operations is guaranteed to be atomic in ConcurrentHashMap?

Q.70Easy

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

Q.71Hard

In Java 2024-25, which enhancement improved record support in collections?

Q.72Easy

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

Q.73Easy

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

Q.74Easy

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

Q.75Easy

What does the PriorityQueue in Java Collections Framework guarantee?

Q.76Medium

Which method is used to remove all elements from a Collection that satisfy a given predicate?

Q.77Medium

What is the key difference between TreeSet and HashSet?

Q.78Easy

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

Q.79Medium

Which interface should be implemented to define custom sorting in Collections.sort()?

Q.80Medium

What does Collections.unmodifiableList() return?