Question: 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 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 variable contains the number 0 before the loop is processed.
a. For Each intX As Integer In intNums
intTotal += intX
Next intX
dblAvg = intTotal / intNums.Length
b. For Each intX As Integer In intNums
intTotal += intNums(intX)
Next intX
dblAvg = intTotal / intX
c. For Each intX As Integer In intNums
intTotal += intNums(intX)
intX += 1
Next intX
dblAvg = intTotal / intX
d. None of the above.

Step by Step Solution

3.49 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a For Each intX As ... View full answer

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

Document Format (2 attachments)

PDF file Icon

1814_60b8c12285ef6_823605.pdf

180 KBs PDF File

Word file Icon

1814_60b8c12285ef6_823605.docx

120 KBs Word File

Students Have Also Explored These Related Programming Microsoft Visual Basic Questions!