更多"有如下的程序片段,该程序片段的执行完后,共执行循环______次。Pr"的相关试题:
[单项选择]有如下的程序片段,该程序片段的执行完后,共执行循环______次。
Private Sub command1_ Click( )
total =0
Counter = 1
do
Print Counter
total = total + Counter
Print total, "111"
Counter = Counter + 1
if total >= 10 then
exit do
End if
Loop while Counter <= 10
End Sub
[单项选择]有如下的程序片段,该程序片段的执行完后,共执行循环______次。
Private Sub command1_ Click( )
total =0
Counter = 1
do
Print Counter
total = total + Counter
Print total, "111"
Counter = Counter + 1
if total >= 10 then
exit do
End if
Loop while Counter <= 10
End Sub
[单项选择]有如下程序段,该程序段执行完后,共执行循环的次数是 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
[单项选择]在窗体上画一个名称为Command1的命令按钮,编写如下程序:
Private Sub Command1_Click( )
Print p1(3,7)
End Sub
Public Function p1(x As Single,n As Integer) As Single
If n=0 Then
p1=1
Else
If n Mod 2=1 Then
p1=x*x+n
Else
p1=x*x-n
End If
End If
End Function
程序运行后,单击该命令按钮,屏幕上显示的结果是( )。
A. 2
B. 1
C. 0
D. 16
[单项选择]在窗体中有一个命令按钮Command1,对应的事件代码如下:
Private Sub Command1_Enter( )
Dim num As Integer
Dim a As Integer
Dim b As Integer
Dim i As Integer
For i=1 To 10
num=InputBox("请输入数据:","输入",1)
If Int(num/2)=num/2 Then
a=a+1
Else
b=b+1
End If
Next i
MsgBox("运行结果:a="& Str(
A. &:",b="& Str(
B. )
C. 对输入的10个数据分别统计有几个是整数,有几个是非整数
D. 对输入的10个数据分别统计有几个是奇数,有几个是偶数
[单项选择]有如下事件过程,单击命令按钮扣,输出结果是( )。
Private Sub Command1 Click( )
Dim b% (1 To4) ,j%, t#
For j=1 To 4
b(j) =j
Next j
t=Tax(b( ) )
Print "t="; t,
End Sub
Function Tax (a( ) As Integer)
Dim t#, i%
t=1
For i=2 To UBound (a)
t=t * a(i)
Next i
Tax=t
End Function
A. t=18
B. t=24
C. t=30
D. t=32
[填空题]设有命令按钮Command1的单击事件过程,代码如下,请填空。
Private Sub Command1_Click( )
Dim a(30) As Integer
For i=1 To 30
a(i) =i
Next
For Each arrItem______a
If arrItem Mod 7=0 Then Print arrItem;
If arrItem>90 Then Exit For
Next
End Sub
[填空题]以下程序段的作用是计算数据的和,数据的个数是可变的。请填空。
Private Sub Command1_Click( )
Dim a As Integer
a=0
Sum a, 1, 5, 2
Print "sum of 3 = "; a
a = 0
Call Sum(a, 1, 3, 5, 7, 9)
Print "sum of 5 = "; a
End Sub
Private Sub Sum(x As integer, 【3】
Dim y As Variant
For 【4】
x = x + y
Next y
End Sub
[填空题]如下程序片段:
in a,b,c;
printf("input a,b,c:");
scanf("a=%d,b=%d,c=%d",&a,&b,&c);
欲使输出结果为1、2、3(分别对应于a、b、c),输入数据的正确形式为 【6】 。
[填空题]计算机系统中发生某个事件时,CPU暂停正在执行的程序,转去执行相应的程序,执行完后再返回原先程序断点继续执行的过程,称为______。
[填空题]计算机系统中发生某个事件时,CPU暂停正在执行的程序,转去执行相应的程序,执行完后再返回原先程序继点继续执行的过程,称为______。
[单项选择]23 有如下程序段,该程序段循环的次数是______。
Dim i As Integer
Dim j As Integer
Dim k As Integer
k=0
For i = 0 To 10 Step 3
For j = 1 To 5
If j > 3 Then k = k + 4: Exit For
k=k+1
Print k
Next j
If i > 8 Then Exit For
Next i
A. 9
B. 10
C. 11
D. 12