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

Consider a scenario: You need a data structure that maintains elements in sorted order and allows fast insertion/deletion. Which is optimal?

Q.22Medium

What exception is thrown by Iterator.next() when there are no more elements?

Q.23Medium

Which method of NavigableSet returns the greatest element strictly less than the given element?

Q.24Medium

What is the output of Collections.frequency(list, null) if list contains null elements?

Q.25Medium

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

Q.26Medium

What is the difference between ArrayList and Vector?

Q.27Medium

Which method of PriorityQueue returns the element without removing it?

Q.28Medium

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

Q.29Medium

Which Collections utility method creates an immutable empty list?

Q.30Medium

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

Q.31Medium

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

Q.32Medium

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

Q.33Medium

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

Q.34Medium

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

Q.35Medium

What is the key difference between TreeSet and HashSet?

Q.36Medium

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

Q.37Medium

What does Collections.unmodifiableList() return?

Q.38Medium

Which collection allows duplicate keys in Java?

Q.39Medium

What is the initial capacity of a HashMap in Java?

Q.40Medium

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

Java Programming MCQs – Free Practice Test | iGET | iGET