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
Which Collections utility method creates an immutable empty list?
In what scenario would you use a ConcurrentHashMap instead of HashMap?
What does the containsAll() method of Collection return for an empty collection?
Consider: Set<Integer> set = new HashSet<>(Arrays.asList(1,2,3,2,1)); System.out.println(set.size()); What is the output?
Which method in NavigableMap returns a view of the map in descending order?
What is the advantage of using LinkedList over ArrayList for frequent insertions at the beginning?
How does Java 8+ handle hash collisions in HashMap differently?
What is the behavior of WeakHashMap when a key is no longer strongly referenced?
Which of these operations is guaranteed to be atomic in ConcurrentHashMap?
What is the primary purpose of the Comparator interface in Collections Framework?
In Java 2024-25, which enhancement improved record support in collections?
Which interface in Java Collections Framework is used to maintain insertion order while allowing duplicates?
What is the time complexity of get() operation in HashMap in average case?
Which collection class is synchronized and thread-safe by default?
What does the PriorityQueue in Java Collections Framework guarantee?
Which method is used to remove all elements from a Collection that satisfy a given predicate?
What is the key difference between TreeSet and HashSet?
Consider: List<String> list = new ArrayList<>(); list.add("Java"); list.add("Python"); What will list.get(1) return?
Which interface should be implemented to define custom sorting in Collections.sort()?
What does Collections.unmodifiableList() return?