The correct answer is: D. 90, 83, 78, 75
The Array.Sort
method sorts the elements of an array in ascending order. The Array.Reverse
method reverses the order of the elements in an array.
In this case, the intScores
array contains the following elements:
- 78
- 83
- 75
- 90
After the Array.Sort
method is called, the array will be sorted in ascending order, with the lowest element first and the highest element last. The array will now contain the following elements:
- 75
- 78
- 83
- 90
After the Array.Reverse
method is called, the order of the elements in the array will be reversed. The array will now contain the following elements:
- 90
- 83
- 78
- 75
Therefore, the output of the following Visual Basic code is:
Dim intScores As Integer = {78, 83, 75, 90}
Array.Sort(intScores)
Array.Reverse(intScores)
Here is a brief explanation of each option:
- Option A: 78, 83, 75, 90. This is the order of the elements in the
intScores
array before theArray.Sort
method is called. - Option B: 75, 78, 83, 90. This is the order of the elements in the
intScores
array after theArray.Sort
method is called, but before theArray.Reverse
method is called. - Option C: 78, 75, 83, 90. This is the order of the elements in the
intScores
array after theArray.Reverse
method is called, but before theArray.Sort
method is called. - Option D: 90, 83, 78, 75. This is the correct output of the following Visual Basic code.