有如下程序段,该程序段执行完后,执行循环的次数是 total=0 Counter=1 Do Print Counter total=total + Counter Print total Counter=Counter+1 If total>10 Then Exit Do End If Loop While Counter <=10
A.5
B.10
C.15
D.20
第1题:
有如下的程序段,该程序段的执行完后,共执行循环的次数是 Private Sub Command1_Click() total=0 Counter=l Do Print Counter total=total+Counter Print total Counter=Counter+1 If total>=10 Then Exit Do End If Loop While Counter<=10 End Sub
A.5
B.10
C.12
D.20
第2题:
下面程序段中循环体的执行次数是[ ]。 a=10; b=0; do{b+=2;a-=2+b; }while (a>=0);
第3题:
有如下程序段: int total = 0; for (int i = 0; i < 4; i++ ){ if (i == 1) continue; if (i == 2) break; total += i; } 则执行完该程序段后total的值为:()
A.0
B.1
C.3
D.6
第4题:
有如下程序段,该程序段执行完后,共执行循环的次数是 Private Sub Command1_Click( ) Tota1=0 Counter=1 Do Print Counter Tota1=tota1+Counter Print total Counter=Counter+1 If total>=10 Then Exit Do End lf Loop While Counter<=10 End Sub
A.5
B.10
C.12
D.20
第5题:
下列程序段执行后,输出结果是: def square(x): total = x * x x += total x = -5 total = 0 square(x) print(x, total, sep=',')
A.出错
B.-5,25
C.20,25
D.-5,0