?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Adding and Removing from ArrayList of Ints

APCSA-V6VFPX

if nums is an array list of integers which contains [10, 9, 30, 22, 17, 50] before the loop begins, what does nums contain after the following segment of code is executed?

for (int i=0; i<nums.size(); i++)
{
        nums.add(nums.remove(i));
}
A

[ ]

B

[10, 9, 30, 22, 17, 50]

C

[50, 10, 9, 30, 22, 17]

D

[50, 17, 22, 30, 9, 10]

E

[9, 22, 50, 30, 10, 17]