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

The following code will enter values into an array named Grades. Let\'s break do

ID: 3810939 • Letter: T

Question

The following code will enter values into an array named Grades. Let's break down this example (note: this is pseudocode)
1. What line of code is entering values into the array?
2. Why is there a FOR loop at the end?
3. Can anyone explain what is happening in the IF function? What is the purpose of MAX?
4. What happens if I change the while loop to: dowhile counter<=10

Begin Loop
counter = 0
Max=0
Declare Double Grades[10]
DoWhile counter < 10
Print "enter Grades: "
Get Grades[counter]
if (Max<Grades[counter])
Max = Grades[counter]
end if
counter=counter+1
EndDo
For i=0 to 9
Print "Grades: " + Grades[i]
End

Explanation / Answer

1. What line of code is entering values into the array?

A) 7th line(Get Grades[counter])

2. Why is there a FOR loop at the end?

A) It will print the grade array

3. Can anyone explain what is happening in the IF function? What is the purpose of MAX?

A) If function is used to get the maximum grade of the grade array . MAX is for storing the maximum grade

4. What happens if I change the while loop to: dowhile counter<=10

A) It will cause an error because In this program array is capable of storing maximum 10 values but ,if you do like this dowhile counter<=10 it means you are reading 11th value to the array ( array index is starts at zero array[10] means reading 11th value)

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