Multiple choice technology programming languages

A Vector is declared as follows. What happens if the code tried to add 6 th element to this Vector new vector(5,10)

  1. The element will not be successfully added

  2. ArrayIndexOutOfBounds Exception

  3. The Vector allocates space to accommodate up to 15 elements

  4. Nothing will happen

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In Java's legacy Vector class, new Vector(5, 10) creates a vector with initial capacity 5 and capacity increment 10. When adding the 6th element exceeds capacity, Vector automatically grows by the increment (10), creating new capacity of 15. This dynamic growth prevents overflow.