网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

有如下程序段,该程序段运行后变量a的值为______。 Dim a As Integer, b As Integer a = 5 : b = 3 If a Mod b = 2 Then a = a ^ 2 Else a = b ^ 2

A.3

B.5

C.9

D.25


参考答案和解析
B解析:执行p=&a;后,p指向整数a,*p即p的目标变量,也就是a;所以a=*p+b等价于
更多 “有如下程序段,该程序段运行后变量a的值为______。 Dim a As Integer, b As Integer a = 5 : b = 3 If a Mod b = 2 Then a = a ^ 2 Else a = b ^ 2A.3B.5C.9D.25” 相关考题
考题 有如下程序:Private Sub Form_Click()Dim i As Integer,Sum As IntegerSum=0For i=2 To 10If i Mod 2<>0 And i Mod 3=0 ThenSum=Sum+iEndIfNextPrint SumEnd Sub程序运行后,单击窗体,输出结果为A.12B.30C.24D.18

考题 执行以下程序段 Dim i As Integer,X As Integer x=0 For i=20 To 1 Step -2 x=x+i\5 Next Print x 后,x的值为______。A. 16B.17C.18D.19

考题 有如下程序: Private Sub Form_Click() Dim i As Integer,Sum As Integer Sum=0 For i=2 To 10 If i Mod 2<>0 And i Mod 3=0 Then Sum=Sum+i End If Next Print Sum End Sub 程序运行后,单击窗体,输出结果为A.12B.30C.24D.18

考题 有如下程序段: Dim I As Integer I=Int(-3.25)执行后,I的返回值是A.-3B.-4C.3D.3.25

考题 执行以下程序段后,x的值为( )。 Dim x As Integer,i As Integer x=0 For i=20 To 0 Step -2 x=x+i\5 Next iA.16B.17C.18D.19

考题 在窗体上有一个命令按钮Commandl,通用过程fun和命令按钮的事件过程如下: Private Function fun(By m As Integer) If m Mod 2=0 Then fun=2 Else Fun=1 Else If End Funcion Private Sub Commandl_Click() Dim i Integer,s As Integer s=0 For i=1 To 5 s=s+fun(i) Next Print s End Sub 程序运行后,单击命令按钮,则窗体上输出A.6 B.7 C.8 D.9

考题 有如下程序:Private Sub Form_Click()Dim i As Integer, sum As Integersum = 0For i = 2 To 10If i Mod 2 0 And i Mod 3 = 0 Thensum = sum + iEnd IfNext iPrint sumEnd Sub程序运行后,单击窗体,输出结果为( )。A.12B.30C.24D.18

考题 下列程序运行后,单击窗体,输出结果为( )。 Private Sub Form_Click() Dim i As Integer, sum As Integer sum = 0 For i = 2 To 10 If i Mod 2 <> 0 Andi Mod 3 = 0 Then sum = sum + i End If Next i Print sum End Sub A. 12B. 18C. 24D. 30

考题 窗体上有一个名为Command1的命令按钮,并有如下程序: Private Sub Corqmand1_Click( ) Dim a As Integer,b As Integer a=8 b=12 Print Fun(a,b);a;b End Sub Private Function Fun(ByVal a As Integer,b AS Integer)As Integer a=a Mod 5 b=b\5 Fun=a End Function 程序运行时,单击命令按钮,则输出结果是( )。A.3 3 2B.3 8 2C.8 8 12D.3 8 12

考题 执行下列程序段后,x的值为______。Dim x As Integer, i As Integerx=0For i=20 To 1 Step -2x=x +i\5Next i

考题 在窗体上画一个命令按钮,然后编写如下程序 Private Sub Command4 Click() Dim a As Integer,b As Integer a=1 b=2 Print N(a,B)End Sub Function N(x As Integer,y As Integer)As Integer N=IIf(x>y,x,y) End Function 程序运行后,单击命令按钮,输出结果为A.lB.2C.5D.8

考题 设有如下程序: Private Static Function Fac(n As Integer)As Integer Dim f As Integer f=f+n Fac=f End Function Private Sub Form_Click( ) Dim I As Integer For 1=2 To 3 Print"#";I“=”Fac(1) Next I End Sub 程序运行后,单击窗体,在窗体上显示的是A.#2=2 #3=3B.#2=2 #3=5C.#;2=2 #;3=3D.#;2=2 #3;=5

考题 执行下列程序后,变量a的值为 ( ) Dim i As Integer Dim a As Integer a=0 For i=l To 100 Step 2 a=a+l Next iA.1B.10C.50D.100

考题 有如下程序: Private Sub Form_Click( ) Dim i As Integer, Sum As Integer Sum = 0 For i = 2 To 10 If i Mod 2=0 And i Mod 3<>0 Then Sum = Sum + i End If Next Print Sum End Sub 程序运行后,单击窗体,输出结果为A.12B.30C.24D.18

考题 窗体上有一个名为Commandl的命令按钮,并有如下程序:Private Sub Command_Click()Dim a As Integer,b As Integera=8b=12Print Fun(a,b);a;bEnd SubPrivate Function Fun(ByVal a As Integer,b As Integer)As Integera=a Mod 5b=b\5Fun=aEnd Function程序运行时,单击命令按钮,则输出结果是A.3 3 2B.3 8 2C.8 8 12D.3 8 1 2

考题 执行以下程序段后,x的值为______。Dim x As Integer,i As Integerx=0For i=20 To 1 Step -2x=x+i\5Next i

考题 执行以下程序段 Dim x As Integer, i As Integer x=0 For i=20 To Step -2 x=x+i\5 Next i 后,x的值为A.16B.17C.18D.19

考题 有如下程序:: Private Sub Form. Click() Dim i As Integer,sum As Integer sum=0 For i=2 To 10 If i Mod 2 <>0 And i Mod 3=0 Then sum=sum+i End If Next i Print sum End Sub 程序运行后,单击窗体,输出结果为______。A. 12B.30C.24D.18

考题 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 iA.9B.10C.11D.12

考题 有如下程序段:Private Sub Command1_Click( ) Dim a As Integer a=2 For i=1 To 3 Print G(A)Next iEnd SubFunction G(a As Integer) b=0 Static c b=b + 1 c=c + 1 G=a + b + cEnd Function运行上面的程序后,单击命令按钮,输出结果为A.1 2 3B.2 3 4C.4 5 6D.1 4 6

考题 有如下程序:Private Sub Form_Click()Dim i As Integer, Sum As IntegerSum=0For i=2 To 10If i Mod 2=0 And i Mod 30 ThenSum=Sum+iEnd IfNextPrint SumEnd Sub程序运行后,单击窗体,输出结果为A.12B.30C.24D.18

考题 阅读下列程序: Private Sub Form Click() Dim i As Integer, sum As Integer For i = 2 To 10 If i Mod 2 <> 0 Then Print i; Else sum = sum + i End If Next i Print sum End Sub 程序运行后,单击窗体,在窗体上的输出结果是A.3 5 7 9 30B.1 3 5 7 9C.2 4 6 8 20D.11 15 17 19 20

考题 单击命令按钮时,下列程序段的执行结果为( )。 Public Sub Procl(n As Integer,ByVal m As Integer) n=n Mod 10 m=m\10 End Sub Private Sub Command1_Click() Dim x As Integer,y As Integer x=12;y=34 Call Procl(x,y) Print x;y End SubA.12 34B.2 34C.2 3D.12 3

考题 在窗体上画一个命令按钮,然后编写如下程序: Private Sub Commandl_Click( ) Dim a AS Integer,b As Integer a=15 b=2 t N(a,B)End Sub Function N(x As Integer,y As Integer) As Integer N=IIf(x)y,x,y) End Function 程序运行后,单击命令按钮,输出结果为A.1B.2C.15D.8

考题 设有如下程序: Private Sub Form_ Click() Dim a Dim i As Integer, j As Integer a = Array(1, 2, 3, 4, 5, 6, 7, 8, 9) For i = 0 To 3 Print a(5 - i) Next End Sub程序运行后,单击窗体,则在窗体上显示的是______。。A.4 3 2 1B.5 4 3 2C.6 5 4 3D.7 6 5 4

考题 在窗体上画一个命令按钮,然后编写如下程序 Private Sub Command1_Click( ) Dim a As Integer,b As hiteger a=1 b=2 Print N(a,B)End Sub Function N(x As Integer,y As Integer)As Integer N=IIf(xy,x,y) End Function 程序运行后,单击命令按钮,输出结果为A.1B.2C.5D.8

考题 若整型变量a值为2、b的值为3,则下列程序段执行后整型变量c的值为______。 If a>5 then If b<4 Then c=a-b Else c=b-a Else If b>3 Then c=a*b Else c=a mod b End IfA. 2B.-1C.1D.6

考题 窗体上有一个名为Commandl的命令按钮,并有如下程序:Private Sub Command 1_Click()Dim a As Integer, b As Integera=8b=12Print Fun(a, b);a; bEnd SubPrivate Function Fun(ByVal a As Integer, b As Integer)As Integera=a Mod 5b=b、5Fun=aEnd Function程序运行时,单击命令按钮,则输出结果是A)3 3 2B)3 8 2C)8 8 12D)3 8 12