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
What is the time complexity of get() operation in TreeMap?
What is the difference between ArrayList and Vector?
Which method of PriorityQueue returns the element without removing it?
What exception is thrown when you try to add a null value to a TreeSet?
Which Collections utility method creates an immutable empty list?
In what scenario would you use a ConcurrentHashMap instead of HashMap?
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?
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?
Which interface should be implemented to define custom sorting in Collections.sort()?
What does Collections.unmodifiableList() return?
Which collection allows duplicate keys in Java?
What is the initial capacity of a HashMap in Java?
What happens when you add a null key to a HashMap?
Which collection implementation is best for frequent insertions and deletions at both ends?
What is the purpose of the fail-fast iterator in Collections?
Consider a TreeMap with Integer keys. What will headMap(10) return?
Which collection interface guarantees that elements are stored in a sorted order with no duplicates?