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.1Hard

Which method throws ConcurrentModificationException when collection is modified during iteration?

Q.2Hard

What is the initial capacity and growth strategy of ArrayList?

Q.3Hard

What is the worst-case time complexity of HashMap.get() when hash collisions occur?

Q.4Hard

What is the behavior of get() method in LinkedHashMap with accessOrder=true?

Q.5Hard

Consider implementing a Comparator for custom sorting in reverse order. Which approach is correct? List<Integer> list = Arrays.asList(5, 2, 8, 1);

Q.6Hard

In a multi-threaded environment, if you need a thread-safe list that allows concurrent reads, which is optimal?

Q.7Hard

In Java 16+, what feature improved collection performance by allowing value-based classes?

Q.8Hard

What is the behavior when concurrent modification occurs during iteration in ConcurrentHashMap vs HashMap?

Q.9Hard

What is the time complexity of subList() operation in ArrayList?

Q.10Hard

Which stream terminal operation preserves encounter order in parallel streams for Collections?

Q.11Hard

What is the worst-case time complexity of QuickSort when used with Collections.sort()?

Q.12Hard

In a scenario where you need to maintain a mapping with LRU (Least Recently Used) eviction policy, which class should be extended?

Q.13Hard

What does the spliterator() method introduced in Java 8 provide over Iterator?

Q.14Hard

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

Q.15Hard

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

Q.16Hard

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

Q.17Hard

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

Q.18Hard

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

Q.19Hard

Which method in Collections can create a thread-safe Map from a non-thread-safe Map?

Q.20Hard

What is the main advantage of EnumSet over HashSet when working with Enum constants?