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

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

以下程序的作用是生成一个如下图的矩阵,该程序不完整,请补充完改程序。

Private Sub Command1_Click()

Dim A(3,3)

For M=1 To 3

For N=1 To 3

If N=M Or【 】Then

A(M,N)=1

Else

【 】=0

End If

Next N

Next M

For M=1 To 3

For N=1 To 3

Print A(M,N);

Next N

Print

Next M

End Sub


参考答案

更多 “ 以下程序的作用是生成一个如下图的矩阵,该程序不完整,请补充完改程序。Private Sub Command1_Click()Dim A(3,3)For M=1 To 3For N=1 To 3If N=M Or【 】ThenA(M,N)=1Else【 】=0End IfNext NNext MFor M=1 To 3For N=1 To 3Print A(M,N);Next NPrintNext MEnd Sub ” 相关考题
考题 下列程序段的执行结果是Dim A(3,3)For M = 1 To 3For N = 1 To 3If N = M Or N = 3 - M + 1 ThenA(M,N) = 1Else A(M,N) = 0 End IfNext NNext MFor M = 1 To 3For N = 1 To 3Print A(M,N)Next NPrint Next MA. 1 0 0 0 1 0 0 0 1 B. 1 1 1 1 1 1 1 1 1C. 0 0 0 0 0 0 0 0 0 D. 1 0 1 0 1 0 1 0 1

考题 下列程序用于判断一个整数是否为质数,试将程序补充完整。Private Sub Command1_Click()Dim n As Integern = InputBox("请输入")t = Int(Sqr(n))i = 2flag = 0While i <= t And flag = 0If ______Thenflag = 1Else: i = i + 1End IfWendIf ______ThenPrint "这是一个质数"ElsePrint "这不是一个质数"End IfEnd Sub

考题 有如下事件过程:Private Sub Command1_Click()Dim m As Integer, n As Integerm=2: n=1Print "m="; m; "n="; nCall TOD(m, n)Print "m="; m; "n="; nEnd SubSub TOD(x, y)x=x ^ 2y=y ^ 3End Sub程序运行后,输出的结果为( )。A.m=2,n=1m=1,n=2B.m=2,n=1m=4,n=1C.m=1,n=2m=1,n=4D.m=1,n=2m=2,n=4

考题 有如下事件过程:Private Sub Command1_Click()Dim i As IntegerFor i=1 To 2DCNext iEnd SubSub DC()Dim x As Integer, m As StringStatic y, nx=x + 1y=y + 1m=m "*": n=n "#"Print x, y, m, nEnd Sub程序运行后,输出的结果是( )。A.1 1 * #1 1 * #B.1 1 * #1 2 * #C.1 1 * #1 1 * ##D.1 1 * #1 2 * ##

考题 ( 24 )在窗体上画 1 个命令按钮,并编写如下事件过程:Private Sub Command1_Click()Dim a(3,3)For m=1 To 3For n=1 To 3If n=m Or n=4-m Thena(m,n)=0End IfPrint a(m,n);Next nPrintNext mEnd Sub运行程序,单击命令按钮,窗体上显示的内容为A )2 0 00 4 00 0 6B )2 0 40 4 04 0 6C )2 3 03 4 00 0 6D )2 0 00 4 50 5 6

考题 在窗体上画1个命令按钮,并编写如下事件过程iPrivate Sub Commandl—Click()Dim a(3,3)For m=1 T0 3F0r n=1 To 3If n=m Or n=4-m Thena(m,n)=m+nElsea(m,n):0End IfPrint a(m,n);Next nPrimNext mEnd Sub运行程序,单击命令按钮,窗体上显示的内容为A.2 0 0B.2 0 4C.2 3 0D.2 0 0

考题 下列程序段的执行结果为Dim A(3,3)For M=1 To 3For N=1 To 3If N=M Or N=3-M+1 ThenA(M,N) =1ElseA(M,N) =0End IfNext NNext MFor M=1 To 3For N=1 To 3Print A(M,N)Next NPrintNext MA.1 0 0 0 1 0 0 0 0B.1 1 1 1 1 1 1 1 1C.0 0 0 0 0 0 0 0 0D. 1 0 1 0 1 0 1 0 1

考题 以下程序的功能是将多维数组a(1 To m,1 To n)中的元素转移到一个名为b(1 To n*m)的一维数组中,完成该程序。OptionBase 1Private Sub Command1_Click(Index As Integer)Dima(1 To 20,1 To 10)Dim b()ReDimb(1 To 200)For i=1 To 20For j=1 To 10A(i,j)=i*jNext jNext iTran a,20,10bEnd SubSub Tran(a()an,n,b())Dim i As IntegerFor i=1 To mFor j=1 To n______=a(i,j)Next jNext iEnd Sub

考题 有如下事件过程: Private Sub Command1_Click( ) Dim m AS Integer,n AS Integer m=2:n=1 Print "m=";m;"n=";n Call TOD(m,n) Print "m=";m;"n=";n End Sub Sub TOD(x,y) x=x^2 y=y^3 End Sub 程序运行后,输出的结果为A.m=2,n=1 m=1,n=2B.m=2,n=1 m=4,n=1C.m=1,n=2 m=1,n=4D.m=1,n=2 m=2,n=4

考题 以下程序用来建立一个10*10矩阵,该矩阵两条对角线上的元素为1,其余元素为0,请补充完该程序。该程序运行结果见下图。Private Sub Form_ click()Dim s(10, 10) As IntegerFor n = 1 To 10For m = 1 To 10If【 】Or【 】Thens (n, m) = 1Elses (n, m) = 0End IfNext mNext nFor n = 1 To 10For【 】。Picturel. Print Tab(m * 3); s(n, m)Next mPrintNext nEnd Sub

考题 阅读下列程序。Option Base 1Private Sub Form. Click()Dim x(3,3)For j=l to 3For k=l to 3If j=k then x(j,k)=lIf j<>k then x(j,k)=kNext kNext jCall fun(x())End SubPrivate Sub fun(x() )For j=1 to 3For k=1 to 3Print x(j,k);Next kNext jEnd Sub运行程序时,输出结果为【 】

考题 阅读以下程序:Private Sub Form_click()Dim k, n, m As integern = 20m = 1k = 1Do While k <= nm=m+2k = k + 1LoopPrint mEnd Sub单击窗体程序的执行结果是【 】。

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

考题 阅读下面的程序: Private Sub Form_Click() Dim m,n As Integer m=InputBox("请输入M的值") m=Val(m) m1=m n=InputBox("请输入N的值") n=Val(n) n1=n Do While n<>0 remin=m Mod n m=n n=remin Loop Print m1,n1,m End Sub 程序运行后,单击窗体,在对话框中分别输入16和24,则程序在窗体上的输出结果为A.16 24 4B.16 24 8C.24 16 6D.24 16 8

考题 有如下程序: Private Sub Commandl_Click( ) Dim i As Integer For i=1 To 2 DS Next i End Sub Sub DS( ) Dim x As Integer,m As String Static y,n X=X + 1 y=y + 1 m=m "*”:n=n"#" Print x,y,m,n End Sub 程序运行后,输出的结果是A.1 1 * #B.1 1 * #C.1 1 * # 1 1 * # 1 2 * #D.1 1 * # 1 1 * ## 1 2 * ##

考题 在窗体上画一个名称为Command1命令按钮,然后编写如下事件过程: Private Function fun1(n As Integer)As Integer Dim k As Integer If n = 1 Then k = 1 Else k = 1 + fun1(n - 1)* 2 End If fun1 = k End Function Private Sub Command1_Click () Dim m As Integer, x As Integer x = 4 m = fun1 (x) Print m End Sub 程序运行后,单击命令按钮,则窗体上显示的内容是A.4B.6C.9D.15

考题 下面程序的功能是从键盘输入—个大于100的整数m,计算并输出满足不等式1+22+32+42+…+n2<m的最大的n。请填空。Private Sub Command1_Click()Dim s,m,n As Integerm=Val(InputBox("请输入一个大于100的整数"))n=【 】s=0Do While s<mn=n+1s=s+n*nLoopPrint "满足不等式的最大n是";【 】End Sub

考题 有如下一个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

考题 设有如下程序: Dim a()As Integer Private Sub Command1_Click() n=-5:m=6 ReDim a(n To m) For i=LBound(a,1)To UBound(a,1) a(i)=i Next i Print a(LBound(a,1));a(UBound(a,1)) End Sub 程序运行后,单击命令按钮,则输出结果是 ______。A.0 0B.-5 0C.-5 6D.0 6

考题 阅读下列程序。Option Base 1Private Sub Form CliCk()Dim x(3,3)For j=1 to 3For k=1 to 3If j=k then x(j,k)=1If j<> k then x(j,k)=3Next kNext jCall fun(x())End SubPrivate Sub fun(a())For j=1 to 3For k=1 to 3Print a (j,k);Next kNext jEnd Sub运行程序时,输出的结果是【 】。

考题 阅读下列程序。Option Base 1Private Sub Form. _Click()Dim x(3,3)For j=1 to 3For k=l to 3If j=k then x(j,k)=1If j<>k then x(j,k)=kNext kNext iCall fun(x())End SubPrivate Sub fun(x())For j=1 to 3For k=1 to 3Print x(j,k);Next kNext jEnd Sub运行程序时,输出结果为【 】。

考题 一下程序的作用是生成一个10×10的矩阵.该矩阵主对角线上的数据为1,其余数据为0(程序运行结果如下图所示)。该程序不完整,请补充完改程序。Private Sub Command1_Click()Dim a(10,10)As IntegerFor i=1 To【 】For j=1 To 10If【 】Then【 】=1Elsea(i,j)=0End IfNext jNext iFor i =1 To 10For j=1 To 10Print a(i,j);Next jPrintNext iEnd Sub

考题 下列程序段的执行结果是( )。Dim A(3,3)For M=1 To 3For N=1 To 3If N=M Or N=3-M+1 ThenA(M,N)=1ElseA(N,N)=0End IfNext NNext MFor M=1 To 3For N=1 To 3Print A(M,N)Next NPrintNext MA.1 0 0 0 1 0 0 0 1B.1 1 1 1 1 1 1 1 1C.0 0 0 0 0 0 0 0 0D.1 0 1 0 1 0 1 0 1

考题 下列程序的作用是求所有小于或等于30的自然数对。该程序不完整,请补充完该程序(程序执行结果见下图)。注:自然数对是指两个自然数的和与差都是平方数(如8与17)。Private Sub Command1_Click()Dim n As LongDim m As LongDim s As SingleDim d As StringFor n=1 To 30For m=1 To【 】s =n+ m【 】If Sqr (s)=Int(Sqr(s))【 】Sqr(D)=Int(Sqr(D))ThenPrint n:mEnd lfNext mNext nEnd Sub

考题 下列程序的运行结果是( )。 Private Function myfun(m, n) Do While m > n Do While m>n:m=m-n:Loop Do while n>m:n=n-m:Loop Loop myfun=m End Function Private Sub Command1_Click() Print myfun(9, 8) End SubA.2B.1C.4D.3

考题 单击命令按钮时,下列程序的执行结果为 Private Sub Command1_Click Dim x As Integer, y As Integer x=12:y=32 Call Proc(x,y. Print x; y End Sub Public Sub Proc(n As Integer, ByVal m As Integer. n=n Mod 10 m=m Mod 10 End SubA.1232B.232C.23D.123

考题 在窗体上画一个名称为Commandl的命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim x As Integer,y As Integer x = 41: y = 54 Call sub1(x,y) x = x + 1 Print x; y End Sub Private Sub sub1(n As Integer, ByVal m As Integer) n=n Mod 10 m=m\10 End Sub 程序运行后,单击命令按钮,则窗体上显示的内容是A.41 54B.2 54C.1 3D.42 3