Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Which of the following correctly displays the highest value in myArray? Constant

ID: 3761635 • Letter: W

Question

Which of the following correctly displays the highest value in myArray?

Constant Integer SIZE = 70

Declare Integer index

Declare Real highValue

Declare Real myArray[SIZE]

Set highValue = myArray[0]

For index = 1 To SIZE -1

    If myArray[index] < highValue Then

         Set highValue = myArray[index]

    End If

End For

Display highValue

Set highValue = myArray[0]

For index = 1 To SIZE -1

    If myArray[index] > highValue Then

         Set highValue = myArray[index]

    End If

End For

Display highValue

Set highValue = myArray[0]

For index = 1 To SIZE -1

    If myArray[index] <= highValue Then

        Set highValue = myArray[index]

    End If

End For

Display highValue

Set highValue = myArray[0]

For index = highValue To SIZE -1

    If myArray[index] > highValue Then

        Set highValue = myArray[index]

    End If

End For

Display highValue

a.

Set highValue = myArray[0]

For index = 1 To SIZE -1

    If myArray[index] < highValue Then

         Set highValue = myArray[index]

    End If

End For

Display highValue

b.

Set highValue = myArray[0]

For index = 1 To SIZE -1

    If myArray[index] > highValue Then

         Set highValue = myArray[index]

    End If

End For

Display highValue

c.

Set highValue = myArray[0]

For index = 1 To SIZE -1

    If myArray[index] <= highValue Then

        Set highValue = myArray[index]

    End If

End For

Display highValue

d.

Set highValue = myArray[0]

For index = highValue To SIZE -1

    If myArray[index] > highValue Then

        Set highValue = myArray[index]

    End If

End For

Display highValue

Explanation / Answer

b is the answer. Same as the previous answer explanation,

Initially assume the first value in the array as the highvalue.

Starting from second value till the last value, compare every value in the array with the highValue. If the array value is higher than the highValue, update the highValue.

By the time you reach the end of the array, highValue will hold the highValue.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote