Multiple choice java

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 be successfully added

  2. ArrayIndexOutOfBounds Exception

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

  4. none of these

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

The constructor new Vector(5, 10) creates a Vector with an initial capacity of 5 and a capacity increment of 10. Adding a 6th element exceeds the initial capacity, triggering the Vector to grow. It will allocate space for 5 + 10 = 15 elements and successfully add the item.