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

Which Collections utility method creates an immutable empty list?

Q.262Medium

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

Q.263Hard

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

Q.264Medium

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

Q.265Medium

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

Q.266Medium

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

Q.267Hard

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

Q.268Hard

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

Q.269Hard

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

Q.270Easy

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

Q.271Hard

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

Q.272Easy

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

Q.273Easy

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

Q.274Easy

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

Q.275Easy

What does the PriorityQueue in Java Collections Framework guarantee?

Q.276Medium

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

Q.277Medium

What is the key difference between TreeSet and HashSet?

Q.278Easy

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

Q.279Medium

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

Q.280Medium

What does Collections.unmodifiableList() return?

Java Programming MCQs – Free Practice Test | iGET | iGET