1、数组及答案解析(总分:40.00,做题时间:90 分钟)一、B选择题/B(总题数:16,分数:32.00)1.在窗体上画一个命令按钮,其名称为 Command1,然后编写如下代码: Option Base 1 Private Sub Command1_Click () Dim a a = Array(1, 2, 3, 4) j = 1 For i = 1 To 4 s = s + a(i) * j j = j * 10 Next i Print s End Sub程序运行后,单击命令按钮,其输出结果是_ 。(分数:2.00)A.1234B.12C.34D.43212.在窗体上画一个名为 Com
2、mand1的命令按钮,然后编写如下代码: Option Base 1 Private Sub Command1_ Click() Dim arr(4, 4) For i = 1 To 4 For j = 1 To 4 arr(i, j) = (i - 1) * 3 + j Next j Next i For i = 1 To 2 For j = 1 To 2 Print arr(i, j) Next j Next i End Sub程序运行后,单击命令按钮,输出结果为_ 。(分数:2.00)A.3 4 6 7B.7 8 10 11C.1 2 4 5D.8 9 12 133.在窗体上画一个名称为
3、 Text1的文本框,然后编写如下代码: Option Base 1 Private Sub Form Click() Dim arr Dim Start As Integer, Finish As Integer Dim Sum As Integer arr = Array(12, 4, 8, 16) Start = LBound (arr) Finish = UBound (arr) Sun = 0 For i = Start To Finish Sum = Sum + arr(i) Next i c = Sum/Finish Text1.Text = c End Sub程序运行后,单击窗
4、体,则在文本框中显示的内容是_ 。(分数:2.00)A.40B.10C.12D.164.在窗体上画一个名称为 Text1的文本框和一个名称为 Command1的命令按钮,然后编写如下事件过程: Private Sub Command1_ Click() Dim Arr(3, 3) As Integer For i = 1 To 3 For j = 1 To 3 If j = i Or j = 3 - i + 1 Then Arr(i, j) = 1 Else Arr(i, j) = 0 End If Next j Next i Print Arr(1, 1) + Arr (2, 2) + Ar
5、r (3, 3) End Sub程序运行后,单击命令按钮,输出结果为_ 。(分数:2.00)A.0B.1C.2D.35.在窗体上画一个命令按钮,名称为 Command1,然后编写如下代码: Option Base 0 Private Sub Command1_Click() Dim Al(4) As Integer, A2(4) As Integer For k = 0 To 2 A1(k + 1) = InputBox (“请输入 1个整数”) A2(3 - k) = A1(k + 1) Next k Print A2(k) End Sub 程序运行后,单击命令按钮,在输入对话框中依次输入
6、2、4、6,输出结果为_ 。(分数:2.00)A.1B.2C.3D.46.设有如下程序: Private Sub Form_ Click() Dim a Dim i As Integer, j As Integer a = Array(1, 2, 3, 4, 5, 6, 7, 8, 9) For i = 0 To 3 Print a(5 - i) Next End Sub程序运行后,单击窗体,则在窗体上显示的是_ 。(分数:2.00)A.4 3 2 1B.5 4 3 2C.6 5 4 3D.7 6 5 47.在窗体上画一个名称为 Text1的文本框和一个名称为 Command1的命令按钮,然后
7、编写如下事件过程: Private Sub Command1_Click() Dim Array1(10, 10) As Integer Dim i, j As Interger For i = 1 To 3 For j = 2 To 4 Array1(i, j) = i + j Next j Next i Text1.Text = Array1(2, 3) + Array1(3, 4) End Sub程序运行后,单击命令按钮,在文本框中显示的值是_ 。(分数:2.00)A.12B.13C.14D.158.在窗体上画一个命令按钮(其 Name属性为 Command1),然后编写如下代码: Op
8、tion 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 i = 1 To 3 p(i) = a(i * i) Next i For i = 1 To 3 k = k + p(i) * 2 Next i Print k End Sub程序运行后,单击命令按钮,输出结果为_ 。(分数:2.00)A.35B.28C.33D.379.在窗体上画一个名称为 Connand1的命令按钮,然后编写如下程序: Private Sub Comma
9、nd1_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程序运行后,单击命令按钮,窗体上显示的是_ 。(分数:2.00)A.1 2 3 2 4 6 3 6 9B.2 3 4 3 4 5 4 5 6C.1 4 7 2 5 8 3 6 9D.1 2 3 4 5 6 7 8 910.在窗体上画一个命令按钮和一个文本框,其名称分别
10、为 Command1和 Text1,然后编写如下事件过程: Private Sub Command1 Click() Dim arr1(10), arr2(10) For i = 1 To 10 arr1(i) = 3 * i arr2(i) = arr1(i) * 3 Next i Text1.Text = Str (arr2(i / 2 - 0.1) End Sub程序运行后,单击命令按钮,在文本框中显示的是_ 。(分数:2.00)A.36B.45C.54D.6311.设有如下程序: Option Base 1 Private Sub Form Click() Dim arr arr =
11、Array(10, 20, “ABCDE“) For i = 3 To 1 Step -1 Print arr(i); Next i End Sub程序运行后,单击窗体,在窗体上显示的内容为_ 。(分数:2.00)A.ABCDE 20 10B.10 20 ABCDEC.ABCDE 10 20D.出错信息12.在窗体上画一个命令按钮,其名称为 Command1,然后编写如下事件过程: Private Sub Command1_ Click() Dim arr (10) For i = 1 To 10 arr (i) = i 2 Next i Print arr(i - 2) End Sub程序运
12、行后,单击命令按钮,在窗体上输出的是_ 。(分数:2.00)A.49B.64C.81D.10013.在窗体上画一个命令按钮(其 Name属性为 Command1),然后编写如下代码; Option Base 1 Private Sub Command1_ Click() Dim a(4, 4), For i = 1 To 4 For j = 1 To 4 a(i, j) = (i - 1) * 3 + j Next j Next i For i = 3 To 4 For j = 3 To 4 Print a(j, i); Next j Print Next i End Sub程序运行后,单击命
13、令按钮,输出结果为_ 。(分数:2.00)A.6 9 7 10B.7 10 8 11C.8 11 9 12D.9 12 10 1314.在窗体上画一个命令按钮(其 Name属性为 Command1),然后编写如下代码: Option Base 1 Private Sub Command1_Click() Dim a a = Array(1, 2, 3, 4) s = 1234 j = 1000 For i = 1 To 4 s = s + a(i) * j j = j * 10 Next i Print S End Sub运行上面的程序,单击命令按钮,其输出结果是_ 。(分数:2.00)A.4
14、321B.2468C.34D.1215.假定通过复制、粘贴建立了一个命令按钮数组 Command1,则以下说法中错误的是 _ 。(分数:2.00)A.数组中每个命令按钮的名称(Name 属性)均为 Command1B.数组中每个命令按钮的大小都一样C.数组中每个命令按钮可以使用同一个事件过程D.用名称 Command1可以访问数组中每个命令按钮16.在窗体上画一个名称为 Command1的命令按钮,然后编写如下程序: Opinion Base 1 Private Sub Command1_ Click() d = 0 c = 10 x = Array(10, 12, 21, 32, 24) F
15、or i = 1 To 5 If x(i) c Then d = d + x(i) Else d = d - c End if Next i Print d End Sub程序运行后,如果单击命令按钮,则在窗体上输出的内容为_ 。(分数:2.00)A.89B.99C.23D.77二、B填空题/B(总题数:4,分数:8.00)17.在窗体上画一个名为 Command1的命令按钮,然后编写如下程序: Option Base 1 Private Sub Command1_ Click() Dim arr arr = Array(358, 32, 46, 73, 23, 59, 26, 91, 583
16、, 12) For i = _ For j = _ If arr(i) = arr(j) Then a = arr(j) arr(j) = arr(i) arr(i) = a End If Next j Next i For i = 1 To 10 Print arr(i); Next i End Sub 程序运行后,单击命令按钮,将把数组 arr中的 10个数按升序排序,请填空。(分数:2.00)填空项 1:_18.以下程序的功能是,产生 10个 01000 之间的随机整数,放入数组 Arr中,然后输出其中的最大值。请填空。 Option Base 1 Private Sub Form Cl
17、ick() Dim Arr(10) As Integer Dim Max As Integer Randomize For I = 1 To 10 Arr(i) = Int (Rnd * 1000) Next i Max= _ For i = 2 To 10 If_ Then Max = Arr(i) End If Next i Print Max End Sub(分数:2.00)填空项 1:_19.在窗体上画一个命令按钮,其名称为 Command1,然后编写如下事件过程: Private Sub Command1_ Click() Dim art(1 To 10) As Integer Fo
18、r i = 1 To 10 Art(i) = Int (Rnd * 100) Next i Max = arr(1) Min = arr(1) For i = 2 To 10 If arr(i) Max Then _ End If If arr(i) Min Then _ End If Next i Print “Max = “; Max, “Min = “; Min End Sub 以上程序的功能是,由程序产生10个 100以内的随机整数,放入数组 arr中,然后输出这 10个数的最大值 Max和最小值 Min,请填空。(分数:2.00)填空项 1:_20.在窗体上画一个命令按钮,其名称为
19、command1,然后编写如下代码: Option Base 1 Private Sub Command1_ Click() Dim Arr Arr = Array(43, 68f -25, 65, -78, 12, -79, 43, -94, 72) pos = 0 neg = 0 For k = 1 To 10 If Art(k) 0 Then Else End If Next k Print pos, neg End Sub 以上程序的功能是,计算并输出数组 Arr中 10个数的整数之和 pos与负数之和 neg,请填空。(分数:2.00)填空项 1:_数组答案解析(总分:40.00,做
20、题时间:90 分钟)一、B选择题/B(总题数:16,分数:32.00)1.在窗体上画一个命令按钮,其名称为 Command1,然后编写如下代码: Option Base 1 Private Sub Command1_Click () Dim a a = Array(1, 2, 3, 4) j = 1 For i = 1 To 4 s = s + a(i) * j j = j * 10 Next i Print s End Sub程序运行后,单击命令按钮,其输出结果是_ 。(分数:2.00)A.1234B.12C.34D.4321 解析:2.在窗体上画一个名为 Command1的命令按钮,然后编
21、写如下代码: Option Base 1 Private Sub Command1_ Click() Dim arr(4, 4) For i = 1 To 4 For j = 1 To 4 arr(i, j) = (i - 1) * 3 + j Next j Next i For i = 1 To 2 For j = 1 To 2 Print arr(i, j) Next j Next i End Sub程序运行后,单击命令按钮,输出结果为_ 。(分数:2.00)A.3 4 6 7B.7 8 10 11C.1 2 4 5 D.8 9 12 13解析:3.在窗体上画一个名称为 Text1的文本框
22、,然后编写如下代码: Option Base 1 Private Sub Form Click() Dim arr Dim Start As Integer, Finish As Integer Dim Sum As Integer arr = Array(12, 4, 8, 16) Start = LBound (arr) Finish = UBound (arr) Sun = 0 For i = Start To Finish Sum = Sum + arr(i) Next i c = Sum/Finish Text1.Text = c End Sub程序运行后,单击窗体,则在文本框中显示
23、的内容是_ 。(分数:2.00)A.40B.10 C.12D.16解析:4.在窗体上画一个名称为 Text1的文本框和一个名称为 Command1的命令按钮,然后编写如下事件过程: Private Sub Command1_ Click() Dim Arr(3, 3) As Integer For i = 1 To 3 For j = 1 To 3 If j = i Or j = 3 - i + 1 Then Arr(i, j) = 1 Else Arr(i, j) = 0 End If Next j Next i Print Arr(1, 1) + Arr (2, 2) + Arr (3,
24、3) End Sub程序运行后,单击命令按钮,输出结果为_ 。(分数:2.00)A.0B.1C.2D.3 解析:5.在窗体上画一个命令按钮,名称为 Command1,然后编写如下代码: Option Base 0 Private Sub Command1_Click() Dim Al(4) As Integer, A2(4) As Integer For k = 0 To 2 A1(k + 1) = InputBox (“请输入 1个整数”) A2(3 - k) = A1(k + 1) Next k Print A2(k) End Sub 程序运行后,单击命令按钮,在输入对话框中依次输入 2、
25、4、6,输出结果为_ 。(分数:2.00)A.1B.2 C.3D.4解析:6.设有如下程序: Private Sub Form_ Click() Dim a Dim i As Integer, j As Integer a = Array(1, 2, 3, 4, 5, 6, 7, 8, 9) For i = 0 To 3 Print a(5 - i) Next End Sub程序运行后,单击窗体,则在窗体上显示的是_ 。(分数:2.00)A.4 3 2 1B.5 4 3 2C.6 5 4 3 D.7 6 5 4解析:7.在窗体上画一个名称为 Text1的文本框和一个名称为 Command1的命
26、令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim Array1(10, 10) As Integer Dim i, j As Interger For i = 1 To 3 For j = 2 To 4 Array1(i, j) = i + j Next j Next i Text1.Text = Array1(2, 3) + Array1(3, 4) End Sub程序运行后,单击命令按钮,在文本框中显示的值是_ 。(分数:2.00)A.12 B.13C.14D.15解析:8.在窗体上画一个命令按钮(其 Name属性为 Command1),然后
27、编写如下代码: 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 i = 1 To 3 p(i) = a(i * i) Next i For i = 1 To 3 k = k + p(i) * 2 Next i Print k End Sub程序运行后,单击命令按钮,输出结果为_ 。(分数:2.00)A.35B.28C.33 D.37解析:9.在窗体上画一个名称为 Connand1的命令按钮,然后编写如下程序: Pri
28、vate 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程序运行后,单击命令按钮,窗体上显示的是_ 。(分数:2.00)A.1 2 3 2 4 6 3 6 9B.2 3 4 3 4 5 4 5 6C.1 4 7 2 5 8 3 6 9D.1 2 3 4 5 6 7 8 9 解析:10.在窗体上画
29、一个命令按钮和一个文本框,其名称分别为 Command1和 Text1,然后编写如下事件过程: Private Sub Command1 Click() Dim arr1(10), arr2(10) For i = 1 To 10 arr1(i) = 3 * i arr2(i) = arr1(i) * 3 Next i Text1.Text = Str (arr2(i / 2 - 0.1) End Sub程序运行后,单击命令按钮,在文本框中显示的是_ 。(分数:2.00)A.36B.45 C.54D.63解析:11.设有如下程序: Option Base 1 Private Sub Form
30、Click() Dim arr arr = Array(10, 20, “ABCDE“) For i = 3 To 1 Step -1 Print arr(i); Next i End Sub程序运行后,单击窗体,在窗体上显示的内容为_ 。(分数:2.00)A.ABCDE 20 10 B.10 20 ABCDEC.ABCDE 10 20D.出错信息解析:12.在窗体上画一个命令按钮,其名称为 Command1,然后编写如下事件过程: Private Sub Command1_ Click() Dim arr (10) For i = 1 To 10 arr (i) = i 2 Next i P
31、rint arr(i - 2) End Sub程序运行后,单击命令按钮,在窗体上输出的是_ 。(分数:2.00)A.49B.64C.81 D.100解析:13.在窗体上画一个命令按钮(其 Name属性为 Command1),然后编写如下代码; Option Base 1 Private Sub Command1_ Click() Dim a(4, 4), For i = 1 To 4 For j = 1 To 4 a(i, j) = (i - 1) * 3 + j Next j Next i For i = 3 To 4 For j = 3 To 4 Print a(j, i); Next j
32、 Print Next i End Sub程序运行后,单击命令按钮,输出结果为_ 。(分数:2.00)A.6 9 7 10B.7 10 8 11C.8 11 9 12D.9 12 10 13 解析:14.在窗体上画一个命令按钮(其 Name属性为 Command1),然后编写如下代码: Option Base 1 Private Sub Command1_Click() Dim a a = Array(1, 2, 3, 4) s = 1234 j = 1000 For i = 1 To 4 s = s + a(i) * j j = j * 10 Next i Print S End Sub运行
33、上面的程序,单击命令按钮,其输出结果是_ 。(分数:2.00)A.4321B.2468 C.34D.12解析:15.假定通过复制、粘贴建立了一个命令按钮数组 Command1,则以下说法中错误的是 _ 。(分数:2.00)A.数组中每个命令按钮的名称(Name 属性)均为 Command1B.数组中每个命令按钮的大小都一样C.数组中每个命令按钮可以使用同一个事件过程D.用名称 Command1可以访问数组中每个命令按钮 解析:16.在窗体上画一个名称为 Command1的命令按钮,然后编写如下程序: Opinion Base 1 Private Sub Command1_ Click() d
34、= 0 c = 10 x = Array(10, 12, 21, 32, 24) For i = 1 To 5 If x(i) c Then d = d + x(i) Else d = d - c End if Next i Print d End Sub程序运行后,如果单击命令按钮,则在窗体上输出的内容为_ 。(分数:2.00)A.89B.99C.23 D.77解析:二、B填空题/B(总题数:4,分数:8.00)17.在窗体上画一个名为 Command1的命令按钮,然后编写如下程序: Option Base 1 Private Sub Command1_ Click() Dim arr ar
35、r = Array(358, 32, 46, 73, 23, 59, 26, 91, 583, 12) For i = _ For j = _ If arr(i) = arr(j) Then a = arr(j) arr(j) = arr(i) arr(i) = a End If Next j Next i For i = 1 To 10 Print arr(i); Next i End Sub 程序运行后,单击命令按钮,将把数组 arr中的 10个数按升序排序,请填空。(分数:2.00)填空项 1:_ (正确答案:1 To 9 或 1 To UBound (arr) -1)解析:i + 1
36、To 10 或 i + 1 To UBound (arr)18.以下程序的功能是,产生 10个 01000 之间的随机整数,放入数组 Arr中,然后输出其中的最大值。请填空。 Option Base 1 Private Sub Form Click() Dim Arr(10) As Integer Dim Max As Integer Randomize For I = 1 To 10 Arr(i) = Int (Rnd * 1000) Next i Max= _ For i = 2 To 10 If_ Then Max = Arr(i) End If Next i Print Max End
37、 Sub(分数:2.00)填空项 1:_ (正确答案:Arr(1) Arr(i) Max)解析:19.在窗体上画一个命令按钮,其名称为 Command1,然后编写如下事件过程: Private Sub Command1_ Click() Dim art(1 To 10) As Integer For i = 1 To 10 Art(i) = Int (Rnd * 100) Next i Max = arr(1) Min = arr(1) For i = 2 To 10 If arr(i) Max Then _ End If If arr(i) Min Then _ End If Next i
38、Print “Max = “; Max, “Min = “; Min End Sub 以上程序的功能是,由程序产生10个 100以内的随机整数,放入数组 arr中,然后输出这 10个数的最大值 Max和最小值 Min,请填空。(分数:2.00)填空项 1:_ (正确答案:Max = arr (i) Min = arr(i))解析:20.在窗体上画一个命令按钮,其名称为 command1,然后编写如下代码: Option Base 1 Private Sub Command1_ Click() Dim Arr Arr = Array(43, 68f -25, 65, -78, 12, -79, 43, -94, 72) pos = 0 neg = 0 For k = 1 To 10 If Art(k) 0 Then Else End If Next k Print pos, neg End Sub 以上程序的功能是,计算并输出数组 Arr中 10个数的整数之和 pos与负数之和 neg,请填空。(分数:2.00)填空项 1:_ (正确答案:pos = pos + Arr (k) neg = neg + Arr (k))解析:
copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1