iGET

Java Programming - MCQ Practice Questions

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

951 questions | 100% Free

Q.261Medium

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

Q.262Hard

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

Q.263Medium

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

Q.264Medium

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

Q.265Medium

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

Q.266Hard

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

Q.267Hard

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

Q.268Hard

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

Q.269Easy

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

Q.270Hard

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

Q.271Easy

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

Q.272Easy

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

Q.273Easy

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

Q.274Easy

What does the PriorityQueue in Java Collections Framework guarantee?

Q.275Medium

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

Q.276Medium

What is the key difference between TreeSet and HashSet?

Q.277Easy

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

Q.278Medium

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

Q.279Medium

What does Collections.unmodifiableList() return?

Q.280Medium

Which collection allows duplicate keys in Java?