网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
运行下列程序:
Private Sub Form_Click( )
For i = 1 To 20
If fun1(i) Then
s = s + 1
End If
Next i
Print s
End Sub
Private Function fun1(y) As Boolean
If y Mod 2 <> 0 Then
fun1 = False
Else
fun1 = True
End If
End Function
单击窗体后,则在窗体上显示的结果是( )。
A.110
B.10
C.0
D.20
参考答案
更多 “ 运行下列程序:Private Sub Form_Click( )For i = 1 To 20If fun1(i) Thens = s + 1End IfNext iPrint sEnd SubPrivate Function fun1(y) As BooleanIf y Mod 2 0 Thenfun1 = FalseElsefun1 = TrueEnd IfEnd Function单击窗体后,则在窗体上显示的结果是( )。A.110B.10C.0D.20 ” 相关考题
考题
阅读程序Option Base 1Private Sub Form_Click()Dim arr,SumSum = 0arr = Array(1,3,5,7,9,11,13,15,17,19)For i=1 To 10If arr(i)/3 = arr(i)\3 ThenSum = Sum + arr(i)End IfNext iPrint SumEnd Sub程序运行后,单击窗体,输出结果为( )。A.13B.14C.27D.15
考题
列程序的功能是:将数据1,2,…,10写入顺序文件Base.txt中,请填空。Private Sub Form_Click()Dim i As IntegerOpen 【11】 As #1For i=1 To 10【12】Next iClose #1End Sub
考题
下列程序的功能是:将数据1,2,…,8写入顺序文件Num.txt中,请补充完整。Private Sub Form_Click()Dim i As IntegerOpen "Num.txt"For Output As #1For i=1 To 8【15】Next iClose #1End Sub
考题
单击窗体时,下列程序的执行结果是Private Sub Invert(ByVal xstr As String, ystr As String)Dim tempstr As StringDim I As IntegerI=Len(xstr)Do While I =1tempstr=tempstr + Mid(xstr, I, 1)I=I - 1Loopystr=tempstrEnd SubPrivate Sub Form_Click()Dim s1 As String, s2 As Strings1= "abcdef"Invert s1, s2Print s2End Sub( )。A.abcdefB.afbecdC.fedcbaD.defabc
考题
(7)在窗体上画一个命令按钮,其名称为 Command1,然后编写如下事件过程:Private Sub Command1_Click( )a$="National Computer Rank Examination"n=Len(a$)s=0For i=1 To nb$=Mid(a$, i, 1)If b$="n" Thens=s+1End IfNext iPrint sEnd Sub程序运行后,单击命令按钮,输出结果是 【7】 。
考题
运行下列程序,单击窗体后输出的结果是( )。Private Sub Form_Click()Dim aDim s As Integer, i As Integera = Array(1, 2, 3, 4, 5, 6)s = 1For i = 5 To 1 Step -2s = s * a(i)Next iPrint sEnd SubA、 15B、 48C、 120D、 720
考题
设有如下程序:Private Sub Form_Click()Dim i As Integer,x As String,Y As Stringx=”ABCDEFG”For i=4 To 1 Step-1y=Mid(x,i,i)+yNext iPrint yEnd Sub程序运行后,单击窗体,输出结果为A.ABCCDEDEFGB.AABBCDEFGC.ABCDEFGD.AABBCCDDEEFFGG
考题
下列程序运行时输出的结果是( )。 Option Base 1 Private Sub Form_Click() Const a=6 Dim x (a) As Integer For I=1 to a x(i)=1^2 Next I Print x(i) End SubA.36B.25C.1D.出错信息
考题
有如下程序: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
考题
下列程序用来计算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
考题
有如下程序:Option Base 1Private Sub Form_Click()Dim arr,SumSum=0For i=1 To 10If arr(i)/3=arr(i)\3 ThenEnd IfNext iEnd Sub程序运行后,单击窗体,消息框的输出结果为( )。
考题
下面程序段的运行结果是【 】。Option Base 1Private Sub Swap (a() As IntegFor I=1 to 10\2t=a(I)a(I)=a(10-I+1)a(10-I+1)=tNext IEnd SubPrivate Sub Form_Click()Dim x(10) As IntegerFor I=1 to 10x(I)=I*2Next ISwap x()For I=1 to 10Print x(I)Next IEnd Sub
考题
执行下面的程序,消息框里显示的结果是_______。Private Sub Form_Click()Dim Str As StringStr=""S="Access"Fori=Len(S)To 1 Step-lStr=StrMid(S,i,1)Next iMsgBox StrEnd Sub
考题
下面程序的输出结果是【 】。Private Sub Form_Click()i=0Do Until 0i=i+1if i>10 then Exit DoLoopPrint iEnd Sub
考题
下面程序是用来打印九九乘法表的,请填空。Private Sub Form_Click()Dim flag As Integer,i As Integer,j As Integer,Str1$Str1=“”For i=1 To 9【 】For j=1 To 9If【 】 Thenstr1=str1+Str$(j)+“*”+Str$(i)+“=”+Str$(Val(i*j))Elsestr1=str1 Chf(13)Exit ForEnd IfNext jNext iPrint str1End Sub
考题
在窗体上画一个命令按钮,其名称为Commandl,然后编写如下事件过程:Private Sub Corrtmandl Click()a$=”Nationalcomputer rank Examination”n=Len(a$)S=0For i=1 To nb$=Mid(a$,i,1)Ifb$=”n”Thens=s+1End IfNext iPrint sEnd Sub程序运行后,单击命令按钮,输出结果是【 】。
考题
下面程序的输出结果是【 】。Private Sub Form_Click()i=0Do Until 0i=i+1if i10 then Exit DoLoopPrint iEnd Sub
考题
使用窗体的Click事件在窗体输出1~1000之间能同时被5和7整除的整数,如图所示,请填空Private Sub Form_Click()Dim i As IntegerDim Sum As IntegerClsFor i=1 To 1000If 【 】 ThenSum=Sum+iPrintiEnd IfNext iPrintPrint"Sum="SumEnd Sub
考题
下列程序的功能是单击窗体时在消息框中输出1000以内能同时被3、5和7整除的整数,请补充完整此程序:Private Sub Form_Click()sum=0For i=1 To 1000If______Thensum=sum+IEnd IfNext IMsgBox sumEnd Sub
考题
下列程序的功能是:将数据1,1,…,8写入顺序文件Num.txt中,请选择正确的程序段( )。Private Sub Form_Click()Dim i As IntegerOpen"Num.txt"For Output As #1For i=1 To 8______Next iClose #1End SubA.print#1,iB.input#1,IC.print#1D.input#1
考题
下面程序运行后的结果是( )。 Private Sub Form_Click() Dim s As Integer,k As Integer,i As Integer,n As Integer s=1 fori=1 to 3 forj=i to 3 for k=j to istep-1 s=s*k nextk,J,i print s End SubA.6B.72C.144D.432
考题
下面的程序运行结果是( )。 Private Sub Form_Click() I=0 DoUntil0 i=i+1 if i>10 then Exit Do Loop Printi End SubA.0B.10C.11D.出错
考题
单击窗体时,下列程序的执行结果是 Private Sub Invert(By Val xstr As String,ystr As String) Dim tempstr AS String Dim I AS Integer I=Len(xstr) Do While I>=1 tempstr=tempstr + Mid(xstr,I,1) I=I - 1 Loop ystr=tempStr End Sub Private Sub Form_Click( ) Dim s1 As String,s2 As String S1="abcdef" Invert S1,S2 Print S2 End SubA.abcdefB.afbecdC.fedcbaD.defabc
考题
运行下列程序:Private Sub form_Click( )Dim sl As String, s2 As Strings1 = "12341234m = 0For i = 3 To 1 Step -1m = m + 1s2 = fun1(s1, m)Debug.Print s2;Next iEnd SubPrivate Function fun1(x, y) As Stringfun1 = Right(x, y)End Function单击窗体后,则在立即窗口内显示结果是( )。A.1234B.4321C.434234D.1111
考题
运行下列程序:Private Sub form_Click( )x = 8: y = 2Call fun1((x), y)Print x, yEnd SubPrivate Sub fun1(x, y)s = xx = s / yy = s Mod yEnd Sub单击窗体后,则在窗体上显示的结果是( )。A.4 2B.8 2C.8 0D.2 4
考题
运行下列程序:Private Sub Form_Click( )Dim a As Integera = 1For i = 1 To 5Call fun1(a)Next iPrint aEnd SubPrivate Sub fun1(x)y = 2Dox = x + yLoop Until x 10End Sub单击窗体后,则在窗体上显示的结果是( )。A.5B.1 2 3 4 5C.19D.7
考题
9)设有如下程序:Private Sub Form_Click( )Clsa$="ABCDFG"For i=1 To 6Print Tab(12-i); 【9】Next iEnd Sub程序运行后,单击窗体,结果如图所示,请填空。
热门标签
最新试卷