Home Subjects Java Programming Collections Framework

Java Programming
Collections Framework

Java OOP, collections, multithreading

22 Q 10 Topics Take Mock Test
Advertisement
Difficulty: All Easy Medium Hard 21–22 of 22
Topics in Java Programming
What is the initial capacity and growth strategy of ArrayList?
A Initial capacity 10, grows by 50%
B Initial capacity 16, grows by 100%
C Initial capacity 10, grows by 100% (1.5x from Java 9)
D Initial capacity 5, grows by 25%
Correct Answer:  C. Initial capacity 10, grows by 100% (1.5x from Java 9)
EXPLANATION

ArrayList starts with capacity 10. Growth factor is 50% + 1 in older versions, and 1.5x from Java 9 onwards.

Test
Which method throws ConcurrentModificationException when collection is modified during iteration?
A Iterator.next()
B Enhanced for loop only
C Both Iterator and enhanced for loop
D Collection.remove()
Correct Answer:  C. Both Iterator and enhanced for loop
EXPLANATION

Both Iterator and enhanced for loop use fail-fast mechanism and throw ConcurrentModificationException if collection is modified during iteration.

Test
IGET
IGET AI
Online · Exam prep assistant
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips