首页/ 题库 / [单选题]阅读程序: Option Base 1 的答案

阅读程序: Option Base 1 Dim arr()As Integer Private Sub Form_Click() Dim i As Integer,j As Integer ReDim arr(3,2) For i=1 To 3 For j=1 To 2 arr(i,j)=i*2+j Next j Next i ReDim Preserve arr(3,4) For j=3 To 4 arr(3,j)=j+9 Next j Print arr(3,2)+arr(3,4) End Sub 程序运行后,单击窗体,输入结果为______。

单选题
2022-07-10 23:13
A、21
B、13
C、8
D、25
查看答案

正确答案
A

试题解析
解析:ReDim语句的功能是为动态数组变量重新分配储存空间。而Preserve的功能是当改变原有数组最末维的大小时,使用此关键字可以保持数组中原来的数据。从题目可以看出,第一个For循环是为第二维为1和 2的数组赋值,而第二个For循环是为第二维为3和4的数组赋值。而arr(3,2)=i*2+i=3*2+2=8, arr(3,4)司+9=-4+9=13,故输出结果为8+13=21。

标签:
感兴趣题目
有以下函数过程: Function Gys (ByVal x As Integer, ByVal y As Integer) As Integer Do While y<>0 Reminder = x Mod y x = y y= Reminder Loop Gys=x End Function 以下是调用该函数的事件过程,该程序的运行结果是 Private Sub Command1_Click() Dim a As Integer Dim b As Integer a = 50 b = 10 x=Gys (a,B)Print x End Sub
阅读程序: Option Base 1 Dim arr( )As Integer Private Sub Form_Click( ) Dim i AsInteger,j As Integer ReDim arr(3,2) For i=1 To 3 Forj=1 To 2 arr(i,j)=i*2+j Next j Next i ReDim Preserve arr(3,4) For j=3 To 4 arr(3,j)=j+9 Nextj Print arr(3,2)+arr(3,4) End Sub 程序运行后,单击窗体,输出结果为
阅读程序: Option Base 1 Dim arr()As Integer Private Sub Form_Click() Dim i As Integer,j As Integer ReDim arr(3,2) For i=1 To 3 For j=1 To 2 arr(i,j)=i*2+j Next j Next i ReDim Preserve arr(3,4) For j=3 To 4 arr(3,j)=j+9 Next j Print arr(3,2)+arr(3,4) End Sub 程序运行后,单击窗体,输入结果为______。
有以下程序: Option Base 1 Dim arr()As Integer Private Sub Form. Click() Dim i As Integer,j As Integer ReDim arr(3,2) For i=1 To 3 For j=1 To 2 arr(i,j)=i*2+j Next j Next i ReDim Preserve arr(3,4) For j=3 To 4 arr(3,j)=j+9 Next j Print arr(3,2);arr(3,4) End Sub 程序运行后,单击窗体,输出结果为______。
在窗体上添加一命令按钮,其名为Command1,然后编写代码如下: private Sub Command1_Click() Dim arr(5)As Integer,arr1(5)AS Integer n=3 For i=1 To 5 arr(i)=i arr1(n)=2*n+i Next Print arr1(n);art(n) End Sub 程序的运行结果为
有如下程序: Option Base 1 Pfivate Sub Form_Click() Dim arr,Sum Sum=0 arr=Array(1,3,5,7,9,11,13,15,17,19) For i=1 To 10 If arr(i)/3=arr(i)3 Then Sum=Sum+arr(i) End If Nexti print Sum End Sub 程序运行后,单击窗体,输出结果为( )。
阅读程序: Option Base 1 Private Sub Form_Click( ) Dim arr,Sum Sum=0 arr=Array(1,3,5,7,9,11,13,15,17,19) For i=1 To 10 If arr(i)/3=arr(i)3 Then Sum=Sum+arr(i) End If Next i Print Sum End Sub程序运行后,单击窗体,输出结果为
有如下程序: Option Base 1 Private Sub Form Click() Dim arr,Sum Sum =0 arr=Array(1,3,5,7,9,11,13,15,17,19) For i=1 To 10 If arr(i)/3=arr(i)3 Then Sum=Sum+arr(i) End If Next i Print Sum End Sub 程序运行后,单击窗体,输出结果为
在窗体上画一个命令按钮(其Name属性为Command1),然后编写如下代码: Private Sub Command1_Click() Dim Arr1(10)As Integer,arr2(10)As Integer n=3 For i=1 To 5 Arr1(i)=i arr2(n)=2*n+i Next i Print arr2(n);Arr1(n) End Sub 程序运行后,单击命令按钮,输出结果是 ______。
单击命令按钮时,下列程度段的执行结果为( )。 Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer a=2:b=4:c=6 Call S1(a,B) Print "a="; a; "b="; b; "c="; c Call S2(a,B) Print "a ="; a; "b ="; b; "c="; c; End Sub Private Sub S1(x As Integer, y As Integer) Dim c As Integer x=2*x:y=y+2:c=x+y End Sub Sub S2(x As Integer, ByVal y As Integer) Dim e As Integer x=2*x:y=y+2:c=x+y End Sub
下面程序运行时,单击窗体后,窗体上显示的结果是( )。 Private Sub Form_Click Dim I As Integer Dim sum As Long Dim t1 As Long t1=1:sum=0 For 1=1 To 3 t1=t1*I sum=sum+t1 Next I Print sum End Sub
当发生Form_Click事件时,窗体上显示的第三行是( )。 Option Base 1 Private Sub Form_Click() Dim i As Integer,j As Integer,k As Integer Dim a(5,5)As Integer For i=1 To 5 k=1 For i=1 To 5 If(i<=j)Then a(i,j)=k k=k+2 Else a(i,j)=k+1 End If Next j Next i For i=1 To 5 For j=1 To 5 Print a(i,j); Next j Print Next i End Sub
相关题目
阅读程序: Option Base 1 Private Sub Form_Click() Dim art,Sum Sum=0 art=Array(1,3,5,7,9,11,13,15,17,19) For i=1 To 10 If arr(i)/3=arr(i)3 Then Sum=Sum+art(i) End If Next i Pdnt Sum End Sub 程序运行后,单击窗体,输出结果为( )。
有如下程序: Option Base 1 Private Sub Form_Click() Dim arr, Sum Sum=0 arr=Array(1, 3, 5, 7, 9, 11, 13, 15, 17, 19) For i=1 To 10 If arE(i)/3=arr(i)3 Then Sum=Sum+arr(i) End If Next i Print Sum End Sub 程序运行后,单击窗体,输出结果为______。
阅读程序: Option Base 1 Private Sub Form_Click() Dim arr, Sum Sum=0 art=Array(1, 3, 5, 7, 9, 11, 13, 15, 17, 19) For i=1 To 10 If arr(i)/3=arr(i)3 Then Sum=Sum+arr(i) End If Next i Print Sum 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 该程序的运行结果为( )。
有如下一个Sub过程: Sub mlt (ParamArray numbers()) n=1 For Each x In numbers n=n * x Next x Print n End Sub在一个事件过程中如下调用该Sub过程: Private Sub Coinmand1_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 则运行该程序,结果为______。
单击一次命令按钮之后,下更程序代码的执行结果为______ 。 Public Sub Proc(a() As Integer) Static i As Integer Do a(i) = a(i) + a(i + 1) i=i+1 Loop While i < 2 End Sub Private Sub Command1_Cliek() Dim m As Integer Dim i As Integer Dim x(10) As Integer For i = 0 To 4 x(i) = i + 1 Next i For i = 1 To 2 Call Proc (x) Next i For i = 0 To 4 Print x(i); Next i End Sub
下列程序运行时输出的结果是 Option Base 1 Private Sub Form_Click() Dim x(10) As Integer,y(5) As Integer For i=1 to 10 x(i)=10-i+1 Next For i=1 to 5 y(i)=x(2*i-1)+x(2*i) Next For i=1 to 5 Print y(i) Next End Sub
下列程序运行时输出的结果是 Option Base 1 Private Sub Form_Click() Dim x (10)As Integer,y(5)As Integer For i=1 to 10 x(i)=10-i+1 Next For i=1 to 5 y(i)=x(2*i-1)+x(2*i) Next For i=1 to 5 Print y(i) Next End Sub
下面程序:________Option Base 1Private Sub Command1_Click() Dim a(10),p(3)As Integer Dim i,k As Integer k=5 For i=1 To 10 a(i)=i Next For i=1 To 3 p(i)=a(i*i) Next For i=1 To 3 k=k+p(i)*2 Next Print kEnd Sub运行后的输出结果为________。
以下程序的输出结果是( )。 Option Base 1 Private Sub Command1 Click() Dim a(10),p(3)as Integer k=5 For I=1 to 10 a(i)=I Next I For j=1 to 3 p(i)=a(I*j) Next j For I=1 to 3 k=k+p(I)*2 Next I Print k End Sub
当Form1_Click事件发生时,窗体上显示的第三行是( )。 Option Base 1 Private Sub Form_Click() Dim i As Integer,j As Integer Dim k As Integer,a(5,5)As Integer For i=1 To 5 k=1 For j=1 To 5 If i<=j Then a(i,j)=k k=k+1 Else a(i,j)=1 End If Next j Next i For i=1 To 5 For j=1 To 5 Print a(i,j); Next j Print Next i End Sub
对窗体编写如下事件过程: Option Base 1 Private Sub Form_KeyPress (KeyAScii AS Integer) arr=Array(12,15,18,20,24) m1=arr(1) m2=1 If fKeyAscii=12 Then For i=2 To 5 If arr(i)>m1 Then m1=arr(i) m2=i End If Next i End If Print m1 Print m2 End Sub 程序运行之后按回车键,输出结果为
用下面的语句定义数组元素的个数为 ______。 Option Base 1 Dim Arr6(-2 to 6, -1 to 5)As Integer
语句Dim Arr(-3 To 5)As Integer定义的数组的元素个数是( )。
下列程序运行时输出的结果是( )。 Option Base 1 Private Sub Form_Click() Dimx(10)As Integer,y(5) As Integer ForI=1 to 10 x(i)=10-I+1 NextI ForI=1 to 5 y(i)cx(2*-1)+x(2*I) NextI ForI=1 to 5 Printy(i); NextI
下列程序运行时输出的结果是( )。 Option Base 1 Const a=10 Private Sub Form_Click() Dim x(a)As Integer k=-1 For i=1 To a x(i)=i*k k=(-1)*k Next i For i=1 To 10 Print x(i) Next i End Sub
在窗体上画一个名称为Connand1的命令按钮,然后编写如下程序: Private Sub Command1_Click() Dim i As Integer, j As Integer Dim a(10, 10) As Integer For i = 1 To 3 For j = 1 To 3 a(i, j) = (i - 1) * 3 + j Print a(i, j); Next j Print Next i End Sub程序运行后,单击命令按钮,窗体上显示的是______。
在窗体上画一个名称为Commandl的命令按钮,然后编写如下程序: Private Sub Command1_Click() Dim i As Integer,j As Integer Dim a(10, 10)As Integer For i=1 To 3 For i=1 To 3 a(i,j)=(i-1) *3+j Print a(i,j); Next i Print Next i End Sub 程序运行后,单击命令按钮,窗体上显示的是
下列事件过程的功能是:建立一个名为Datal的随机文件,存放角度值及这些角度的正弦函数值和余弦函数值,角度为1,2,3,…,90。请在空白处填入适当的内容,将程序补充完整。 Private Type Ang K As Integer Sinx As Single Cosx As Single End Type Dim Ksc As Ang Private Sub Form_Click() Dim Y As Single Dim i As Integer Dim
程序代码如下,当单击窗体上的Command1控件时,在窗体上输出的结果是( )。 Private Sub Command1_Click() Dim aa(3,3)As Integer Dim i As Integer,j As Integer Dim s As Integer For i=0 To 3 For j=0 To 3 aa(i,j)=i*4+j+1 Next j Next i For i=0 To 3 s=s+aa(i,1) Next i Print s End Sub
广告位招租WX:84302438

免费的网站请分享给朋友吧