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

What is the time complexity of get() operation in TreeMap?

Q.122Medium

What is the difference between ArrayList and Vector?

Q.123Medium

Which method of PriorityQueue returns the element without removing it?

Q.124Medium

What exception is thrown when you try to add a null value to a TreeSet?

Q.125Medium

Which Collections utility method creates an immutable empty list?

Q.126Medium

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

Q.127Medium

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

Q.128Medium

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

Q.129Medium

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

Q.130Medium

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

Q.131Medium

What is the key difference between TreeSet and HashSet?

Q.132Medium

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

Q.133Medium

What does Collections.unmodifiableList() return?

Q.134Medium

Which collection allows duplicate keys in Java?

Q.135Medium

What is the initial capacity of a HashMap in Java?

Q.136Medium

What happens when you add a null key to a HashMap?

Q.137Medium

Which collection implementation is best for frequent insertions and deletions at both ends?

Q.138Medium

What is the purpose of the fail-fast iterator in Collections?

Q.139Medium

Consider a TreeMap with Integer keys. What will headMap(10) return?

Q.140Medium

Which collection interface guarantees that elements are stored in a sorted order with no duplicates?