1
3
5
6
第1题:
程序段s=i=0;do{i=i+1;s=s+i;}while(i=n);的时间复杂度为()。
A、O(n)
B、O(nlog2n)
C、O(n)
D、O(n/2)
第2题:
以下能够正确计算n!的程序是
A.Private Sub Command1_Chck( ) n=5:x=1 Do x=x*i i=i+1 Loop While i<n Print x End Sub
B.Private Sub Command1_Click( ) n=5:x=1:i=l Do x=x*i i=i+1 Loop While i<n Print x End Sub
C.Private Sub Command1_Click( ) n=5:x=1:i=l Do x=x*i i=i+1 Loop While i<=n Print x End Sub
D.Private Sub Command1_Click( ) n=5:x=1:i=l Dox=x*i i=i+1 Loop While i>n Print x End Sub
第3题:
如下程序显示的结果是 ( )。
s=1
i=0
do while i<8
s=s+i
i=i+2
end do
s
13
第4题:
A、16
B、12
C、28
D、21
第5题:
下列程序的运行结果是______。
main()
{ int s=0,i=1;
while(s<= 10)
{ s=s+i*i;
i++;
}
printf("%d",-i);
}
第6题:
下列程序段的时间复杂度为()。i=0,s=0;while(sn){s=s+i;i++;}
A、O(n1/2)
B、O(n1/3)
C、O(n)
D、O(n2)
第7题:
以下能够正确计算n! 的程序是( )。
A.Private Sub Command1_Click( ) n=5:x=l Do x=x*i i=i+1 Loop While i < n Print x End Sub
B.Private Sub Command1_Click( ) n=5:x=1:i=1 Do x=x*i i=i+1 Loop While i < n Print x End Sub
C.Private Sub Command1_Cliek( ) n:5:x=1:i=1 Do x=x* i i:i+1 Loop While i < = n Print x End Sub
D.Private Sub Command1_Cliek( ) n=5:x:1:i=1 Do x=x*i i=j+1 Loop While i > n Print x End Sub
第8题:
如下程序显示的结果是 S=1 i=0 do while i<8 s=s+i i=i+2 enddo?s
第9题:
下面的程序段运行后,变量S的值变为“65666768”,则程序中“表达式”为( )。 i+1Do While 表达式 S=S & ASC(Chr¥(i+64)) i=i+1 LoopA.i>5B.NOT(i<>5)C.i<5D.i=5
第10题:
执行如下程序,最后S的显示值为( )。 SET TALK OFF s=0 i=2 x=10 DO WHILE s<一一X S=S+i i=i十l ENDDO ?S SET TALK ON
A.12
B.14
C.16
D.18