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

Which interface does HashMap implement in Java Collections Framework?

Q.2Easy

What is the time complexity of get() method in HashMap?

Q.3Easy

Which of the following collections maintains insertion order?

Q.4Easy

What is the difference between ArrayList and LinkedList?

Q.5Medium

Which method is used to remove an element from ArrayList while iterating?

Q.6Medium

What is the load factor in HashMap? What is its default value?

Q.7Easy

Which collection does NOT allow duplicate elements?

Q.8Medium

What is the time complexity of add() operation in TreeSet?

Q.9Medium

Which of the following is thread-safe?

Q.10Medium

What does the Comparable interface do in Collections Framework?

Q.11Medium

Which collection is best for frequent insertions and deletions in the middle?

Q.12Easy

What is the difference between TreeSet and HashSet in sorting?

Q.13Hard

Which method throws ConcurrentModificationException when collection is modified during iteration?

Q.14Hard

What is the initial capacity and growth strategy of ArrayList?

Q.15Medium

Given: Map<String, Integer> map = new HashMap<>(); map.put("A", 10); map.put("B", 20); map.put("A", 30); What will be the size of map?

Q.16Medium

Which interface provides sorted ordering in Collections Framework?

Q.17Hard

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

Q.18Medium

Which collection class is synchronized and legacy?

Q.19Easy

Which method in Set collection prevents duplicate insertion by returning false?

Q.20Easy

What is the output of LinkedHashMap iteration in the following code? LinkedHashMap<String, Integer> map = new LinkedHashMap<>(); map.put("A", 1); map.put("B", 2); map.put("C", 3); for(String key : map.keySet()) System.out.print(key);