What will the following code display in the lblSum control? Dim intSum As Integer Dim intY As Integer Do While intY < 3 For intX As Integer = 1 To 4 intSum = intSum + intX Next intX intY = intY + 1 Loop lblSum.Text = Convert.ToString(intSum)

5
8
15
30

The correct answer is C. 15.

The code will display 15 in the lblSum control because the loop will iterate 3 times, and each time it iterates, the value of intSum will be increased by the value of intX, which is 1, 2, and 3, respectively. Therefore, the value of intSum will be 1 + 2 + 3 = 6 after the first iteration, 6 + 4 = 10 after the second iteration, and 10 + 5 = 15 after the third iteration.

Option A is incorrect because the value of intSum will be 6 after the first iteration of the loop, not 5.

Option B is incorrect because the value of intSum will be 10 after the second iteration of the loop, not 8.

Option D is incorrect because the value of intSum will be 15 after the third iteration of the loop, not 30.

Exit mobile version