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 all of the values of myArray? Constant

ID: 3761639 • Letter: W

Question

Which of the following correctly displays all of the values of myArray?

Constant Integer SIZE = 40

Declare Integer index

Declare Real myArray[SIZE]

For index = 1 To SIZE-1

    Display "myArray[", index, "] = ", myArray[index]

End For

For index = 0 To SIZE

    Display "myArray[", index-1, "] = ", myArray[index-1]

End For

For index = 0 To SIZE-1

    Display "myArray[", index, "] = ", myArray[index]

End For

For index = 1 To SIZE

    Display "myArray[", index, "] = ", myArray[index]

End For

a.

For index = 1 To SIZE-1

    Display "myArray[", index, "] = ", myArray[index]

End For

b.

For index = 0 To SIZE

    Display "myArray[", index-1, "] = ", myArray[index-1]

End For

c.

For index = 0 To SIZE-1

    Display "myArray[", index, "] = ", myArray[index]

End For

d.

For index = 1 To SIZE

    Display "myArray[", index, "] = ", myArray[index]

End For

Explanation / Answer

The correct answer is:

For index = 0 To SIZE-1

    Display "myArray[", index, "] = ", myArray[index]

End For

Reason : Array index starts from 0.

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