int i=1,total=1;
while(i<5)
{
total+=i;
i+=1;
}
int i=1,total=0;
while(i <=5)
{
total+=i;
i+=1;
}
int i=0,total=0;
while(i <5)
{
i+=1;
total+=i;
}
int i=0,total=0;
while(i <=5)
{
total+=i;
i+=1;
}
第1题:
A、COUNT
B、SUM
C、AVERAGE
D、TOTAL
第2题:
有如下的程序段,该程序段执行完后,共执行的循环次数是 total=0 Counter=1 Do Print Counter total=total * Counter + 1 Print total Counter=Counter +1 If total > 10 Then Exit Do End If Loop While Counter<=10
A.4
B.10
C.15
D.20
第3题:
设有以下程序段:
struct MP3
{ char name[20];
char color;
float price;
}std,*ptr;
ptr=&std:
若要引用结构体变量std中的color成员,写法错误的是( )。
A.std.color
B.ptr->color
C.std->color
D.(*ptr)color
本题中要引用结构体变量std中的color,要使用指针,而std.color不是一个指针类型,所以答案选择A。
第4题:
以下程序段中,不能正确给字符串赋值(编译时系统会提示错误)的是:( )
第5题:
有如下的程序段,该程序段的执行完后,共执行循环的次数是 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
第6题:
A、COUNT
B、SUM
C、AVERAGE
D、TOTAL
第7题:
有如下程序段,该程序段执行完后,执行循环的次数是 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
第8题:
有如下程序段,该程序段执行完后,执行循环的次数是
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
第9题:
有下面的程序段,其功能是按图2所示的规律输出数据( )。若要按图3所示的规律继续输出数据,则接在上述程序段后面的程序段应该是( )。
第10题:
若变量已正确定义,有以下程序段:其输出结果是( )。
A.程序段有语法错误
B.3,5,3
C.3,5,5
D.3,5,7