网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
某人设计了下列程序用于计算并输出5!(5的阶乘):
Private Sub Command1_Click()
t=0
For k=5 To 2 Step -1
t=t*k
Next k
Print t
End Sub
执行程序时,发现结果是错误的。下列修改方案中能够得到正确结果的是_______
A. 把t=0改为t=1
B. 把For k=5 To 2 Step -1改为For k=5 To 1 Step -1
C. 把For k=5 To 2 Step -1改为For k=1 To 5
D. 把Next改为Next t
参考答案
更多 “ 某人设计了下列程序用于计算并输出5!(5的阶乘):Private Sub Command1_Click()t=0For k=5 To 2 Step -1t=t*kNext kPrint tEnd Sub执行程序时,发现结果是错误的。下列修改方案中能够得到正确结果的是_______A. 把t=0改为t=1B. 把For k=5 To 2 Step -1改为For k=5 To 1 Step -1C. 把For k=5 To 2 Step -1改为For k=1 To 5D. 把Next改为Next t ” 相关考题
考题
阅读下列程序:Private Sub Command1_Click()Dim i As Integer, k As Integerk=2For i=1 To 3Print H(k) ;Next iEnd SubFunction H(j As Integer)a=0Static ba=a + 1b=b + 1H=a*b + jEnd Function程序运行后,单击命令按钮输出结果是( )。A.2 3 4B.3 4 5C.5 6 7D.3 5 6
考题
以下能够正确计算n!的程序是( )。A.Private Sub Command1_Click()n=5: x=1Dox=x * II=I + 1Loop While I nPrint xEnd SubB.Private Sub Command1_Click()n=5: x=1: I=1Dox=x * II=I + 1Loop While I nPrint xEnd SubC.Private Sub Command1_Click()n=5: x=1: I=1Dox=x * II=I + 1Loop While I =nPrint xEnd SubD.Private Sub Command1_Click()n=5: x=1: I=1Dox=x * II=I + 1Loop While I nPrint xEnd Sub
考题
( 27 )下面程序执行时,在窗体上显示的是Private Sub Command1_Click()Dim a(10)For k = 1 To 10a(k) = 11 – kNext kPrint a(a(3)\a(7) Mod a(5))End SubA ) 3B ) 5C ) 7D )9
考题
阅读程序:Private Sub Command1_Click()A=0For j=1 to 15a=a+j mod 3Next jPrint aEnd Sub程序运行后,单击窗体,输出结果是A )105B)1C)120D)15
考题
下面运行程序后,单击命令按钮,输出的结果是 【 】 。Private Sub Command1_Click()Dim a%(1 To 5),i%, s#For i=1 To 5a(i)=iNexts=Fun(a)Print "s="; s;End SubFunction Fun(a() As Integer)Dim t#, i%t=1For i=LBound(a) To UBound(a)t=t a(i)NextFun=tEnd Function
考题
以下能够正确计算n!的程序是A.Private Sub Command1 Click() n=5:x=1 Do x=x * I I=I + 1 Loop While I < n Print x End SubB.Private Sub Command1_Click() n=5:X=1:I=1 Do X=X*I I=I + 1 Loop While I <n Print x End SubC.Private Sub Command1_Click() n=5:X=1:I=1 Do X=X * I I=I + 1 Loop While I<=n Print X End SubD.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
考题
窗体上有一个命令按钮,命令按钮的单击事件过程如下: Private Sub Command1_Click() Dim a a=Array(1,2,3,4,5) For k=1 To 4 s=s+a(k) Next Print S End Sub 运行程序后,单击命令按钮,输出结果是A.10B.14C.15D.120
考题
下面运行程序后,单击命令按钮,输出出的结果是【 】。Private Sub Command1_Click( )Dim a% (1 To 5) ,i%, sFor i = 1 To 5a(i) =iNexts = Fun(a)Print"s="; s;End SubFunction Fun(a() As Integer)Dim t, i%t=1For i = LBound(A0To UBound(a)t=t * a(i)NextFun =tEnd Function
考题
假定有如下的Sub过程: Sub Func(x As Single, y As Single) t=x x=t/y y=t Mod y End Sub 在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim a As Single Dim b As Single a=6 b=5 Func(a, B) Print a, b End Sub 程序运行后,单击命令按钮,输出结果为 ______。A.6 5B.1 1C.1.2 5D.1.2 1
考题
某人设计了如下程序用来计算并输出7!(7的阶乘)Private Sub Command1 Click( ) t=0 For k=7 To 2 Step-1 t=t*k Next Print t End Sub 执行程序时,发现结果是错误的,下面的修改方案中能够得到正确结果的是( )。A.把t=0改为t=1B.把For k=7 To 2 Step-1改为For k=7 T0 1 Step-1C.把For k=7 To 2 Step-1改为For k=1 T0 7D.把Next改为Next k
考题
有如下的程序: Private Sub Command1_Click() Dim k As Integer,m As Integer Dim P As Integer k=4:m=1 P=Fun(k,m):Print P; P=Fun(k,m):Print P End Sub Private Function Fun(a As Integer,b As Integer) Static m As Integer,i As Integer in=5:i=2 i=i+m+1 m=i+a+b Fun=m\2 End Function 单击命令按钮后,输出结果为A.2 2B.4 4C.5 5D.6 6
考题
以下能够正确计算n!的程序是A.Privas Sub Command1_Click() n=5:x=1 Do x=x*i i=i+1 Loop While i<n Print x End SubB.Private Sub Command1_Click() n=5:x=1:i=1 Do x=x*i i=i+1 Loop While i<n Print x End SubC.Private Sub Command1_Click() n=5:x=1:i=1 Do x=x*i i=i+1 Loop while i<=n Print x End SubD.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
考题
假定有如下的Sub过程:Sub Sub1(x As Single,y As single)t=xx=t/yy=t Mod yEnd Sub在窗体上画一个命令按钮,然后编写如下事件过程:Private Sub Command1_click()Dim a As SingleDim b As Singlea=5b=4Sub1 a,bPrint a;bEnd Sub程序运行后,单击命令按钮,输出结果为A.B.C.D.
考题
下列程序的功能是单击窗体时在消息框中输出1000以内能同时被3、5和7整除的整数,请补充完整此程序:Private Sub Form_Click()sum=0For i=1 To 1000If______Thensum=sum+IEnd IfNext IMsgBox sumEnd Sub
考题
某人设计了如下程序用于计算并输出7!(7的阶乘): Private Sub Command1_Click t = 0 For k = 7 To 2 Step -1 t = t * k Next Print t End Sub 执行程序时,发现结果是错误的。下面的修改方案中能够得到正确结果的是。 A.把t=0改为t=1 B.把For k=7 TO 2 Step -1改为For k=7 TO 1 Step -1 C.把For k=7 TO 2 Step -1改为For k=1 TO 7 D.把Next改为Next k
考题
以下能够正确计算n!的程序是A.Private Sub Command1_Click( ) n=5: x=1 Do x=x*i i=i+1 Loop While i<n Print x End SubB.Private Sub Command1_Click( ) n=5: x=1: i=1 Do x=x*i i=i+1 Loop While i<n Print x End SubC.Private Sub Command1_Click( ) n=5:x=1:i=1 Do x=x*i i=i+1 Loop While i<= n Print x End SubD.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
考题
下列程序用于输出一个主对角线上元素值为“*”,其他元素值为“”的5×5阶的方阵,试将程序补充完整。Private Sub Command1_Click()Dim x(5, 5)For i = 1 To 5For j = 1 To 5If ______Thenx(i, j) = '*'Else______End IfPrint ______Next jPrintNext iEnd Sub
考题
阅读下列程序: Private Sub Command1_Click() Dim i As Integer, k As Integer k=2 For i=1 To 3 Print H(k); Next i End Sub Function H(j As Integer) Static b a=0 a=a+1 b=b+1 H=a*b+jEnd Function单击命令按钮,执行程序,输出结果是( )。A.2 3 4B.3 4 5C.5 6 7D.3 5 6
考题
某人设计了如下程序用来计算并输出7!(7的阶乘)Private Sub Command1 Click( )t=0For k=7 To 2 Step-1t=t*kNextPrint tEnd Sub执行程序时,发现结果是错误的,下面的修改方案中能够得到正确结果的是( )。A.把t=0改为t=1B.把For k=7 To 2 Step-1改为For k=7 T0 1 Step-1C.把For k=7 To 2 Step-1改为For k=1 T0 7D.把Next改为Next k
考题
若有如下程序: Private Sub Command1_Click() Dim i As Integer, k As Integer k=2 For i = 1 To 3 Print H(k); Next i End Sub Function H(j As Integer) Static b a=0 a=a+1 b=b+1 H=a*b+j End Function 单击命令按钮,执行程序,输出结果是( )。A.2 3 4B.3 4 5C.5 6 7D.3 5 6
考题
阅读下列程序。Private Sub Command1_Click()Dim i As Integer, k As Integerk=2For i=1 To 3Print Fun(k) ;NextEnd SubFunction Fun(j As Integer)Static ba=0a=a + 1b=b + 1Fun=a b + jEnd Function程序运行后,单击命令按钮输出结果是A.2 3 4B.3 4 5C.5 6 7D.3 5 6
考题
当Form1_Click事件发生时,程序的输出结果是( )。 Private Sub Form_Click() Dim M As Integer,k As Integer,t As Integer M=5:k=7 Select Case M Case Is<0 M=M+5 Case 1 To 10 t=M:M=k:k=t Case Else M=k Mod 3 End Select Print M,k,t End SubA.5 5 7B.5 7 5C.7 5 5D.7 5 7
考题
编写如下通用过程: Sub Proc(x As Single, y As Single) t = x x = t/y y = t Mod y End Sub 在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub Command1_Click () Dim a As Single Dim b As Single a = 5 b = 4 Proc a, b Print a, b End Sub 程序运行后,如果单击命令按钮,则输出结果为A.5 4B.1.25 1C.4 5D.1.25 5
考题
在窗体上画一个按钮,然后编写如下的事件代码。在按钮上单击,输出为( )。 Private Sub fun3(x As Integer) Static a As Integer Dim b As Integer a=a+3:b=b+3 a=a+x:b=b+x Printa;b End Sub Private Sub Command1_Click() Dim k As Integer,m As Integer,n As Integer k=2:m=1 Call fun3(k) Call fun3(m) End SubA.5 5 9 9B.5 5 9 4C.5 5 4 4D.5 5 4 9
考题
下列程序运行后的输出结果是______。Private Sub f(k,s)s=1For j=1 To ks=s*jNextEnd SubPrivate Sub Command1_Click()Sum=0For i=1 To 3Call f(i,s)Sum=Sum+sNextPrint SumEnd Sub
考题
下面程序运行后,单击命令按钮,输出的结果是______。Private Sub Command1_Click()Dim a%(1 To 5),i%,sFor i=1 To 5a(i) =iNexts=Fun(A)Print "s=";s;End SubFunction Fun(a() As Integer)Dim t,i%t=1For i=LBound(A)To UBound(A)t=t*a(i)NextFun=tEnd Function
考题
单选题下面程序执行时在窗体上显示的是()。 Private Sub Command1_Click() Dim a(10) For k=1 to 10 a(k)=11-k Next k Print a(a(3)/a(7)Mod a(5)) End SubA
3B
5C
7D
9
热门标签
最新试卷