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

11. Which loop computes the sum of 1/2+2/3+3/4 +4/5...+99/100? (A) For n As Inte

ID: 3891852 • Letter: 1

Question

11. Which loop computes the sum of 1/2+2/3+3/4 +4/5...+99/100? (A) For n As Integer 1 To 99 (B) For q As Integer 100 To 1 (c) For d As Integer 2 To 99 (D) For x As Integer 1 To 100 s+ n / (1 n) Next Next Next Next (E) none of the above 12. In the following code segment, what role does the variable check serve? Dim counter As Integer, check As Boolean Do While counter20 counter += 1 If counter 10 Then check = True End If Loop (A) counter (B) accumulator (C) flag (D) loop control variable (E) none of the above

Explanation / Answer

ist option computes the sum of 1/2 + 2/3 + 3/4 + 4/5 + .... +99/100

beacuse n is in the range of 1 to 99

so ist time n will be 1 and the value of s will be n/(n+1) which is 1/2

next n will be 2 so s will be previous value + 2/3 which is 1/2 + 2/3

and so on upto 99

s will be 1/2 + 2/3 + .... + 99/100

so Option A is correct

in second question check is used as flag to specify that counter value has reached value 10

so check is used as flag

option C is correct

Dr Jack
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote