Solved

Assume That an Integer Array Named IntValues Contains IntNUM Elements

Question 15

Multiple Choice

Assume that an integer array named intValues contains intNUM elements. Which of the following code segments most efficiently finds the largest element in the array and displays it in a label named lblMaxValue? Assume that values have already been inserted into the array.


A) For intIndex = 0 To intNUM - 1 If (intValues(intIndex) > CInt(txtMax.Text) ) Then
LblMaxValue.Text = intValues(intIndex) .ToString
End If
Next intIndex
B) intMax = intValues(0) For intIndex = 1 to intValues.length - 1
If intValues(intIndex) > intMax Then
IntMax = intValues(intIndex)
End If
Next
LblMaxValue.text = intMax.ToString
C) For intIndex = 0 To intNUM If intValues(intIndex) > intMax Then
IntValues(intIndex) = intMax
End If
Next
LblMaxValue.Text = intMax.ToString
D) intMax = intValues(0) For intIndex = 1 To intValues.length
If intValues(intIndex) > intMax) Then
IntMax = intValues(intIndex)
LblMaxValue.Text = intMax.ToString
End If
Next

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents