1、【
简答题】
[10分]
解析:
Private Sub Clea_Click()
P1.Cls
End Sub
Private Sub Dis_Click()
P1.Print "等级考试"
End Sub
2、【
简答题】
' 提供给考生的程序
Option Base 1
Dim Arr1(20) As Integer
Dim Arr2(20) As Integer
Sub ReadData1()
Open App.Path & "\" & "datain1.txt" For Input As #1
For i = 1 To 20
Input #1, Arr1(i)
Next i
Close #1
End Sub
Sub ReadData2()
Open App.Path & "\" & "datain2.txt" For Input As #1
For i = 1 To 20
Input #1, Arr2(i)
Next i
Close #1
End Sub
[10分]
解析:
' 需考生定义的变量
Dim Sum As Integer
Sub WriteData(Filename As String, Num As Integer)
Open App.Path & "\" & Filename For Output As #1
Print #1, Num
Close #1
End Sub
Private Sub C1_Click()
ReadData1
ReadData2
End Sub
Private Sub C2_Click()
Dim Arr3(20) As Integer
Sum = 0
For i = 1 To 20
Arr3(i) = Int(Arr1(i) / Arr2(i))
Sum = Sum + Arr3(i)
Next i
Print "Sum = "; Sum
End Sub
Private Sub C3_Click()
WriteData "DataOut.txt", Sum
End Sub
3、【
简答题】
[10分]
解析:
Private Sub Form_Click()
If Op1 And Op3 Then
Text1.Text = "坐飞机去广州"
ElseIf Op1 And Op4 Then
Text1.Text = "坐飞机去昆明"
ElseIf Op2 And Op3 Then
Text1.Text = "坐火车去广州"
ElseIf Op2 And Op4 Then
Text1.Text = "坐火车去昆明"
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Open App.Path & "\out3.txt" For Output As #1
Print #1, Op1.Value, Op2.Value, Op3.Value, Op4.Value, Text1.Text
Close #1
End Sub
4、【
简答题】
[10分]
解析:
Private Sub Form_Unload(Cancel As Integer)
Open App.Path & "\out3.txt" For Output As #1
Print #1, Op1.Value, Op2.Value, Op3.Value, Op4.Value, Text1.Text
Close #1
End Sub
Private Sub Text1_Click()
If Op1 And Op3 Then
Text1.Text = "坐汽车去青岛"
ElseIf Op1 And Op4 Then
Text1.Text = "坐汽车去大连"
ElseIf Op2 And Op3 Then
Text1.Text = "坐轮船去青岛"
ElseIf Op2 And Op4 Then
Text1.Text = "坐轮船去大连"
End If
End Sub
5、【
简答题】
[10分]
解析:
Private Sub Clea_Click()
Cls
End Sub
Private Sub Dis_Click()
Print "等级考试"
End Sub
VERSION 5#
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 165
ClientTop = 735
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Menu Op
Caption = "操作"
Begin VB.Menu Dis
Caption = "显示"
End
Begin VB.Menu Clea
Caption = "清除"
End
End
End
Private Sub Clea_Click()
Cls
End Sub
Private Sub Dis_Click()
Print "等级考试"
End Sub
6、【
简答题】
' 提供给考生的程序
Option Base 1
Dim Arr1(20) As Integer
Dim Arr2(20) As Integer
' 提供给考生的程序
Sub ReadData1()
Open App.Path & "\" & "datain1.txt" For Input As #1
For i = 1 To 20
Input #1, Arr1(i)
Next i
Close #1
End Sub
' 提供给考生的程序
Sub ReadData2()
Open App.Path & "\" & "datain2.txt" For Input As #1
For i = 1 To 20
Input #1, Arr2(i)
Next i
Close #1
End Sub
' 提供给考生的程序
Sub WriteData(Filename As String, Num As Integer)
Open App.Path & "\" & Filename For Output As #1
Print #1, Num
Close #1
End Sub
[10分]
解析:
' 要求考生编写的程序
Dim Sum As Integer
' 要求考生编写的程序
Private Sub C1_Click()
ReadData1
ReadData2
End Sub
' 要求考生编写的程序
Private Sub C2_Click()
Dim Arr3(20) As Integer
Sum = 0
For i = 1 To 20
Arr3(i) = Int(Arr1(i) / Arr2(i))
Sum = Sum + Arr3(i)
Next i
Print "Sum = "; Sum
End Sub
' 要求考生编写的程序
Private Sub C3_Click()
WriteData "DataOut.txt", Sum
End Sub
7、【
简答题】
[10分]
解析:
Dim a(5, 10) As Integer
Dim s(5)
Private Sub Command1_Click()
Open App.Path & "\in4.txt" For Input As #1
For i = 1 To 5
For j = 1 To 10
Input #1, a(i, j)
Next j
Next i
Close #1
End Sub
Private Sub Command2_Click()
For i = 1 To 5
s(i) = 0
For j = 1 To 10
s(i) = a(i, j) + s(i)
Next j
s(i) = CInt(s(i) / 10)
Text1(i - 1) = s(i)
Next i
End Sub
Private Sub Command3_Click()
For k = 1 To 5
Shape1(k - 1).Height = s(k) * 20
m = Line2.Y1
Shape1(k - 1).Top = m - Shape1(k - 1).Height
Shape1(k - 1).Visible = True
Next k
End Sub
8、【
简答题】
[10分]
解析:
Private Sub L1_DblClick()
L1.Parent.Lab1.Caption = L1.Parent.L1.ListCount
End Sub
9、【
简答题】
[10分]
解析:
Private Sub L1_DblClick()
L1.AddItem L1.Text
End Sub
10、【
简答题】
[10分]
解析:
Private Sub Form_Click()
If Op1 Then
Lab1.Caption = Text1.Text
Text1.Text = Text2.Text
Text2.Text = Lab1.Caption
Lab1.Caption = "交换成功"
ElseIf Op2 Then
Lab1.Caption = Text1.Text & Text2.Text
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Open "out4.txt" For Output As #1
Print #1, Op1.Value, Op2.Value, Text1.Text, Text2.Text, Lab1.Caption
Close #1
End Sub