Question: 5. The intNums array is declared as follows: Dim intNums() As Integer = {10, 5, 7, 2}. Which of the following blocks of code correctly

5. The intNums array is declared as follows: Dim intNums() As Integer = {10, 5, 7, 2}.

Which of the following blocks of code correctly calculates the average value stored in the array? The intTotal, intSub, and dblAvg variables contain the number 0 before the loop is processed.

a. Do While intSub < 4 intNums(intSub) = intTotal + intTotal intSub += 1 Loop dblAvg = intTotal / intSub

b. Do While intSub < 4 intTotal += intNums(intSub)

intSub = intSub + 1 Loop dblAvg = intTotal / intSub

c. Do While intSub < 4 intTotal += intNums(intSub)

intSub += 1 Loop dblAvg = intTotal / intSub – 1

d. Do While intSub < 4 intTotal = intTotal + intNums(intSub)

intSub = intSub + 1 Loop dblAvg = intTotal / (intSub – 1)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock