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

Visual Studio Multiple choice Multiple Choice (10 points in total) Dim Sum As In

ID: 3573235 • Letter: V

Question

Visual Studio Multiple choice

Multiple Choice (10 points in total)

Dim Sum As Integer = 0
Dim Count As Integer = 0

Do
    Sum += CINT(InputBox("Enter a grade"))
    Count
+= 1
Loop While Count < = 35

How many times does this Do-Loop execute?

Dim Sum As Integer = 0
Dim Count As Integer = 1

Do
    Sum += CINT(InputBox("Enter a grade"))
    Count
+= 1
Loop While Count < 35

What is the value of Count after the first iteration of the Do-Loop?

Dim Sum As Integer = 0
Dim Count As Integer = 0

Do
    Sum += CINT(InputBox("Enter a grade"))
    Count
+= 1
Loop While Count < 35

If the Do-Loop runs X times, and each time the user enters 2, what is the final value of Sum?

Dim Sum As Integer = 0
Dim Count As Integer = 0

Do
    Sum += CINT(InputBox("Enter a grade"))
    Count
+= 1
Loop Until Count < 35

How many times does this Do-Loop execute?

Question 1.1. After declaring a variable of type String, which of the following can be done? (Points : 2) a) change its content type to Integer using the CINT function.
b)not assign the variable to ""
c)assume if the variable was not assigned at declaration then it contains "0"
d)None of the above Question 2.2.

Dim Sum As Integer = 0
Dim Count As Integer = 0

Do
    Sum += CINT(InputBox("Enter a grade"))
    Count
+= 1
Loop While Count < = 35

How many times does this Do-Loop execute?

(Points : 2) a) 36, because count goes from 1 to 35 inside the loop, but at 35 the loop iterates one more time and that makes it 35 + 1 times.
b)36, because count goes from 0 to 35 inside the loop and from 0 to 35 is 35.
c)1 because the loop only runs once as the While condition is at the end.
d)The information provided is not sufficient to answer the question. Question 3.3.

Dim Sum As Integer = 0
Dim Count As Integer = 1

Do
    Sum += CINT(InputBox("Enter a grade"))
    Count
+= 1
Loop While Count < 35

What is the value of Count after the first iteration of the Do-Loop?

(Points : 2) a)35
b)34
c)2
d)1 Question 4.4.

Dim Sum As Integer = 0
Dim Count As Integer = 0

Do
    Sum += CINT(InputBox("Enter a grade"))
    Count
+= 1
Loop While Count < 35

If the Do-Loop runs X times, and each time the user enters 2, what is the final value of Sum?

(Points : 2) a)unknown
b)X
c)Nothing
d)2X Question 5.5.

Dim Sum As Integer = 0
Dim Count As Integer = 0

Do
    Sum += CINT(InputBox("Enter a grade"))
    Count
+= 1
Loop Until Count < 35

How many times does this Do-Loop execute?

(Points : 2) a) 35
b) 34
c)1
d)0

Explanation / Answer

Question 1.1:

Answer is : a) change its content type to Integer using the CINT function.

why?

Dim Sum As String
Dim i As Integer = CINT(Sum)
Console.WriteLine(Sum)

Output:

0

Question 2.2.

Answer is :b)36, because count goes from 0 to 35 inside the loop and from 0 to 35 is 35.

why?
the loop starts from 0 to 35 and on 35 time count increments to 36 and exits

Question 3.3.

Answer is :a)35

why?
on 35th time the condition check 35 < 35 and the condition fails and exits loop

Question 4.4.

Answer is :d)2X

why?
Count loop until X times .. i.e 35 time so 2 * 35 = 70

Question 5.5.

Answer is :a) 35

why?
loop runs untill Count 0 - 34 times and on 34th time Count increments to 35 and fails so 35 times