Question Detail

COM 101 COM 101 Past Questions Objective Question

Question

The following For-Next loop makes _________ passes. Sum=0 For I = 1 to 20 Sum=Sum+1 Next I
Options
A 19
B 20
Correct Answer
C 21
D 5
Correct Answer

Option B is the correct answer.

Detailed Explanation

A 'For I = 1 to 20' loop will execute its body (Sum=Sum+1) exactly 20 times: once when I=1, I=2, ..., up to I=20.

Hint

Count from the start value to the end value, inclusive.

Question Info