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.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.