You have a dynamic array with 3 elements in it and a capacity of 4. The capacity
ID: 3746420 • Letter: Y
Question
You have a dynamic array with 3 elements in it and a capacity of 4. The capacity doubles when additional space is needed. Which of the options are true? Select all that apply.
you can select multiple options, from none to all:
a. The valid indexes to remove from the current array only include 0,1,2 b. The valid indexes to remove from the current array only include 0,1,2,3 c. The valid indexes to insert into the current array only include 0,1,2 d. The valid indexes to insert into the current array only include 0,1,2,3 e. If we now perform three appending operations, the capacity of the array will become 8 f. If we now perform three appending operations, the capacity of the array will become 6Explanation / Answer
a. It is true as the 3 elements already present are at indexes 0, 1, 2.
d. It is true as the current capacity is 4 and hence a new element can be added at any index from 0 through 3.
e. The first append will make its capacity full at 4. Then its gets doubled to incorporate the next append. Hence final capacity is 8.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.