?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Easy

Sorting an Array of Values in Descending Order

APCSA-VOVHTE

Note that the result of the code below is to sort the array (named array) in DESCENDING order.

String[] array = {"15", "4.1", "140", "2000.5", "0", "31.25", "5"};
Arrays.sort(array);
Collections.reverse(Arrays.asList(array));

What is the status of array after the following code is executed?

A
arrays = {"5", "4.1", "31.25", "2000.5", "15", "140", "0"}
B
arrays = {"5", "31.25", "0", "2000.5", "140", "4.1", "15"}
C
arrays = {"0", "140", "15", "2000.5", "31.25", "4.1", "5"}
D
arrays = {"2000.5", "140", "31.25", "15", "5", "4.1", "0"}
E
arrays = {"0", "4.1", "5", "15", "31.25", "140", "2000.5"}