网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
设有如下程序: Private Sub Command1_Click() Dim C As Integer, d As Integer c=4 d=InputBox("请输入一个整数") Do While d>0 If d>c Then c=c+1 End If d=InputBox("请输入一个整数") Loop Print c+d End Sub 程序运行后,单击命令按钮,如果在输入对话框中依次输入1、2、3、4、5、6、7、8、9、0,则输出结果是______。
A.12
B.11
C.10
D.9
参考答案
更多 “ 设有如下程序: Private Sub Command1_Click() Dim C As Integer, d As Integer c=4 d=InputBox("请输入一个整数") Do While d>0 If d>c Then c=c+1 End If d=InputBox("请输入一个整数") Loop Print c+d End Sub 程序运行后,单击命令按钮,如果在输入对话框中依次输入1、2、3、4、5、6、7、8、9、0,则输出结果是______。A.12B.11C.10D.9 ” 相关考题
考题
在窗体中添加一个命令按钮,然后编写如下程序:Private Sub Command1_Click()Dim a As Integer, b As Integera=InputBox(“Enter the Firstinteger”)b=InputBox(“Enter the Secondinteger”)Print b+aEnd Sub程序运行后,单击命令按钮,先后在两个输入框中分别输入123和123,则输出结果是( )。A.246B.123C.456D.123123
考题
有一过程如下:Sub Sub1(m As Integer,total As Long)Dim i As Integertotal=1For i=1 To mtotal=total*iNextEnd Sub调用它的事件过程如下:Private Sub Command1_Click()Dim tot As Long,a As Integera=Val(InputBox("请输入数据"))Call Sub1(a,tot)Print totEnd Sub则输入数据5,运行结果为【 】。
考题
以下程序代码用来实现如下功能:单击命令按钮弹出对话框,在其中输入正数后单击确定,弹出一个提示信息显示刚才输入的正数,否则提示"error"。请填空。Private Sub Command1_Click()Dim a As Integer,b As Stringa=InputBox("请输入一个正数")If a > 0 Then______Elseb=MsgBox("error",0)End IfEnd Sub
考题
在窗体上画一个命令按钮,然后编写如下程序: Sub S1(ByVal x As Integer,ByVal y As Integer) Dim t As Integer t=x x=y y=t End Sub Private Sub Command1_Click() Dim a As Integer,b As Integer a=10 b=30 S1 a,b Print"a=";a;"b=";b End Sub 程序运行后,单击命令按钮,输出结果是 ______。A.a=30 b=10B.a=30 b=30C.a=10 b=30D.a=10 b=10
考题
在窗体上画1个命令按钮,名称为Command1,然后编写如下程序: Dim Flag As Boolean Private Sub Command1_Click() Dim intNum As Integer intNum=InputBox(“请输入:”) If Flag Then Print f(intNum) End If End Sub Function f(X as Integer)As Integer If X<10 Then Y=X Else Y=X+10 End If f=Y End Function Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X as Single,Y As Single) Flag=True End Sub 运行程序,首先单击窗体,然后单击命令按钮,在输入对话框中输入5,则程序的输出结果为______。A.0B.5C.15D.无任何输出
考题
设有如下程序: Private Sub Commandl_click() Dim c As Integer,d As Integer c=4 d=InputBox("请输入一个整数") Do While d>0 If d>c Then c=c+1 End If d=InputBox("请输入一个整数") Loop Print c+d End Sub 程序运行后,单击命令按钮,如果在输入对话框中依次输入1、2、3、4、5、6、7、8、9、 0,则输出结果是A.12B.11C.10D.9
考题
设有如下程序:Private Sub Command1_Click()Dim c As Integer, d As Integerc = 4d = InputBox("请输入一个整数")Do While d 0If d c Then c = c + 1End If d = InputBox("请输入一个整数")LoopPrint c + dEnd Sub程序运行后,单击命令按钮,如果在输入对话框中依次输入1、2、3、4、5、6、7、8、9、0,则输出结果是( )。A.12B.11C.10D.9
考题
下列程序用来计算1+2+…n,当和大于100时停止计算,请填空。Private Sub Form_Click()Dim n as integer,s as integer,I as integer,k as integers=0k=0n=inputbox(″请输入n的值)For i=1 to 100k=k+1s=s+I【 】Next iPrint sEnd Sub
考题
设程序中有如下数组定义和过程调用语句: Dim a(10)As Integer … Call D(a) 如下过程定义巾,正确的是( )。A.Private Sub p(a As Integer)B.Private Sub p(a( )As Integer)C.Private Sub p(a(10)As Integer)D.Private Sub p(a(n)As Integer)
考题
有如下程序: Private Sub Command1_Click() Dim k As Integer,m As Integer Dim p As Integer k=4:m=1 p=PC(k,m):Print p; p=PC(k,m):Print p End Sub Private Function PC(a As Integer,b As Integer) Static m As Integer,i As Integer m=0:i=2 i=i + m + 1 m=i + a + b PC=m End Function 程序运行后,输出的结果为A.4 6B.6 6C.8 8D.10 12
考题
单击命令按钮,并在对话框内依次输入5,7,6下列程序段的执行结果为______。 Private Sub Command1_Click() Dim n AS Integer, a As Integer, b As Integer, c As Integer n = 0 For i = 1 To 3 a = InputBox ("请输入数字") n = n+a*a If n > 50 Then GoTo ex End If Next i ex: Print n End SubA.25B.74C.85D.110
考题
设有如下程序: 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
考题
Command1_Click()事件代码如下: Private Sub Command1_Click() Dim x As Integer, Y As Integer x = 6 : Y : 8 Call ABC(X, Y) Print X; Y End Sub Private Sub ABC(ByVal X As Integer,Y As Integer) X = X + 4 Y = Y = 2 End Sub 事件发生后,X和Y的值分别为 ______。A.6, 8B.10, 10C.10, 8D.6, 10
考题
以下有关数组定义的语句序列中,错误的是 ______。A.Static arrl(3) arrl(1)=100 arrl(2)="Hello" arrl(3)123.45B.Dim arr2()As Integer Dim size As Integer Private Sub Command2_click() size=InputBox("输入:") ReDimarr2(size) End SubC.Option Base1 Private Sub Command3_click() Dim arr3(3)As Integer End SubD.Dim n As Integer Private Sub Command4_Click() Dim arr4(n)As Integer End Sub
考题
有如下程序: Private Sub Command1_Click() Dim k As Integer,m As Integer Dim op As Integer k=4:m=1 p=PPC(k,m):Print op; p=PPC(k.m):Print op End Sub Private Function PPC(a As Integer,b As Integer) Static m As Integer,i As Integer m=0:i=2 i=i+m+1 m=i+a+b PPC=m End Function 程序运行后,输出的结果为A.4 6B.6 6C.8 8D.10 12
考题
有如下函致: Function fact(x As Integer)As Long Dim p As Long,i As Integer p=1 For i=1 To x p=p*1 Next fact=p End Function 调用它的事件过程如下: Private Sub Command1_Click() i=Val(Inputbox("请输入数据")) a=fact((i)) Print a End Sub 若输入数据5,则运行结果为A.120B.60C.80D.100
考题
设有如下程序: Private Sub Command1_Click( ) Dim c As Integer,d As Integer c=4 d=InputBox(“请输入一个整数”) Do While d>0 If d>c Then C=C+1 End lf d=InputBox(“请输入一个整数”) Loop Print c+d End sub 程序运行后,单击命令按钮,如果在输入对话框中依次输入1、2、3、4、5、6、7、8、9、0,则输出结果是A.12B.11C.10D.9
考题
有如下一个Sub过程: Sub mlt(ParamArray numbers()) n=1 For Each x In numbers n=n*x Next x Print n End Sub 在一个事件过程中如下调用该Sub过程: Private Sub Command1_Click() Dim a As Integer Dim b As Integer Dim c As Integer Dim d As Integer a=1 b=2 c=3 d=4 mlt a,b,c,d End Sub 该程序的运行结果为( )。A.12B.24C.36D.48
考题
设有如下程序: Option Base 1 Private Sub Command1_Click() Dim a(10) As Integer Dim n As Integer n=InputBox("输入数据") If n<10 Then Call GetArray(a,n) End If End Sub Private Sub GetArray(b()As Integer,n As Integer) Dim c(10)As Integer j=0 For i=1 To n b(i)=Clnt(Rnd()*100) Ifb(i)/2=b(i)\2 Then j=j+1 c(j)=b(i) End If Next Print j End Sub 以下叙述中错误的是( )。A.数组b中的偶数被保存在数组C中B.程序运行结束时,在窗体上显示的是c数组中元素的个数C.GetArray过程的参数n是按值传送的D.如果输入的数据大于10,则窗体上不显示任何信息
考题
阅读下列程序: Dim SW As Boolean Function func(X As Integer)As Integer If X<20 Then Y=X Else Y=20+X End If func=Y End Function Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single, Y As Single) SW=False End Sub Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single, Y As Single) SW=True End Sub Private Sub Command1_Click() Dim intNum As Integer intNum=InputBox(" ") If SW Then Print func(intNum) End If End Sub 程序运行后,单击一次窗体,再单击命令按钮,将显示一个输入对话框,如果在对话框中输入20,则程序的输出结果为A.0B.20C.40D.无任何输出
考题
有过程如下:Sub fact (m As Integer, total As Long) Dim i As Integer total = 1 for i = 1 To m total = total*i Next iEnd Sub调用它的事件过程如下:Private Sub Command1_ Click () Dim tot As Long Dim a As Integer a = Val InputBox (“请输入数据”)) Call fact (a, tot) Print totEnd Sub则输入数据5,运行结果为 ______。A.100B.120C.200D.50
考题
设程序中有如下数组定义和过程调用语句:Dim a(10) as integer……Call p(a)如下过程定义中,正确的是A)Private Sub p(a as integer)B)Private Sub p(a() as integer)C)Private Sub p(a(10) as integer)D)Private Sub p(a(n) as integer)
考题
设有如下程序: Private Sub Form. Click( ) Dim ary(1 To 5)As Integer Dim i As Integer Dim sum As Integer For i=1 To 5 ary(i)=i+l sum=sum+ary(i) Next i Print sum End Sub 程序运行后,单击窗体,则在窗体上显示的是( )。A.15B.16C.20D.25
考题
设有Function过程:Private Function f(a As Integer, b As Integer) As Integera = a * a:b = b * bf = CInt(Sqr(a - b))End Function则如下程序段的运行结果是( )。Private Sub Command1_Click()Dim X As Integer, Y As IntegerX = 5: Y = 4a = f(X, Y)Print aEnd SubA. 5B. 4C. 3D. 9
考题
在窗体上画一个按钮,然后编写如下的事件代码。在按钮上单击,输出为,( )。 Private Sub fun(ByVal x As Integer,ByVal y As Integer,Byval z As Integer) z=x^3*y^3 End Sub Private Sub Command1_Click() Dim m As Integer Call fun(2,3,m) Print m End SubA.216B.0C.35D.程序不能运行
考题
在窗体上画一个名称为Coramandl的命令按钮,然后编写如下程序; Dim SW As Boolean Function func(X As Integer)As Integer If X<20 Then Y=X Else Y=20+X End If func=Y End Function Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim a As Boolean SW=False End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) SW=True End Sub Private Sub Command1_Click() Dim intNum As Integer intNum=InputBox("") If SW Then Print flmc(intNum) End If End Sub 程序运行后,单击命令按钮,将显示一个输入对话框,如果在对话框中输入25,则程序的执行结果为A.输出0B.输出2C.输出45D.无任何输出
考题
在窗体上画一个命令按钮,然后编写如下程序 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
考题
在窗体上添加一个命令按钮,编写事件过程:Private Sub Command1_Click()Dim a As Integer,b As Integera=InputBox("Enter the First integer")b=InputBox("Enter the Second integer")Print b+aEnd Sub程序运行后,单击命令按钮,先后在两个输入对话框中分别345和678,则输出结果是( )。A.1023B.678345C.678D.345
热门标签
最新试卷