Govt. Exams
Entrance Exams
Advertisement
Topics in Java Programming
What is the initial capacity and growth strategy of ArrayList?
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.
Which method throws ConcurrentModificationException when collection is modified during iteration?
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.