Limited access

Upgrade to access all content for this subject

Consider the following code segment.

int i=status.size()-1;
while(i>=status.size()/2)
{
    String temp = status.get(Math.abs(i-status.size()+1));
    status.set(Math.abs(i-status.size()+1), status.get(i));
    status.set(i, temp);
    i--;
}

What is the result after the following segment of code is executed if status is an array list of Strings which contains [freshman, sophomore, junior, senior, graduate] before the loop begins?

A

The elements in status are reversed

B

The elements in status remain in the same order

C

The elements in status are sorted in descending order

D

The elements in status are sorted in ascending order

E

The elements in status are in no particular order

Select an assignment template