亿万文档 免费下载
计算机二级考试VB上机练习题
〖第1题〗『程序填空』(1分)(题号:532)
【程序填空】''题目:输入n个数,n由用户输入。 ' 程序的功能是将输入的n个数反向输出? 请在【】处填入正确的 Private Sub Form_Load() Dim n As Integer Dim k As Integer Dim m As Integer Dim h As Integer Dim t As Integer Show
Dim a(100) As Single
n = Val(InputBox("输入个数n")) Print "处理前数据 :"
'**********SPACE********** For k = 1 To 【?】
a(k) = Val(InputBox("请输入第" & k & "个数"))
Print a(k); Next k Print
'**********SPACE********** m = Int(【?】) For k = 1 To m h = n - k + 1
'**********SPACE********** t = a(h): 【?】: a(k) = t Next k
Print "处理的结果 :" For k = 1 To n Print a(k); Next k End Sub 答案:1). n 2). n / 2 3). a(h) = a(k)
〖第2题〗『程序填空』(1分)(题号:498) '【程序填空】
''题目:本程序执行功能为,命令按钮单击一次后,窗体上输出结果为: '36 '25 '16 '9
请在【】处填入正确的内容 Private Sub Command1_Click() Dim xx(6) As Integer Dim k%
Open App.Path & "\al.dat" For Output As #1 For I = 1 To 6
'**********SPACE********** j = 【?】 Print #1, j Next I Close #1
Open App.Path & "\a1.dat" For Input As #2 k = 0
Do While Not EOF(2)
'**********SPACE********** k = 【?】 Input #2, xx(k) Loop Close #2
'**********SPACE********** For I = k To k / 2 Step【?】 Form1.Print xx(I) Next I End Sub 答案: 1). I * I
2). k + 1 或 1 + k 3). -1
〖第3题〗『程序填空』(1分)(题号:501) '【程序填空】
''题目:本程序执行后,最终在窗体上打印数字7。请在【】处填入正确的内容 Private Sub Command1_Click() Dim a As String
'**********SPACE**********
Open App.Path & "\abc.bat" For 【?】 As #1 n = 8 For I = 1 To n Print #1, I + 1 Next I Close #1
'**********SPACE**********
Open App.Path & "\abc.bat" For 【?】 As #1 For I = 1 To n
猜你喜欢