1、【
简答题】
[10分]
解析:
Private Sub C1_Click()
If Op1 And Op3 Then
Lab1.Caption = "坐飞机去广州"
ElseIf Op1 And Op4 Then
Lab1.Caption = "坐飞机去昆明"
ElseIf Op2 And Op3 Then
Lab1.Caption = "坐火车去广州"
ElseIf Op2 And Op4 Then
Lab1.Caption = "坐火车去昆明"
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, Lab1.Caption
Close #1
End Sub
2、【
简答题】
[10分]
解析:
Private Sub C1_Click()
Text1.Text = "等级考试"
End Sub
3、【
简答题】
Private x As Integer
Private Sub Command1_Click()
x = Val(InputBox("请输入正整数"))
End Sub
Private Sub Command2_Click()
'Select Case Combo1.?
Case 0
' MsgBox Str(x) & ?
Case 1
' MsgBox Str(x) & ?
Case Else
Exit Sub
End Select
End Sub
Private Function f1(ByVal x As Integer) As String
If x \ 2 <> x / 2 Then
f1 = "是奇数"
Else
f1 = "是偶数"
End If
End Function
'Private Function f2(ByVal x As Integer) ?
' If x Mod 7 = ? Then
f2 = "能被7整除"
Else
f2 = "不能被7整除"
End If
End Function
[10分]
解析:
Private x As Integer
Private Sub Command1_Click()
x = Val(InputBox("请输入正整数"))
End Sub
Private Sub Command2_Click()
Select Case Combo1.ListIndex
Case 0
MsgBox Str(x) & f1(x)
Case 1
MsgBox Str(x) & f2(x)
Case Else
Exit Sub
End Select
End Sub
Private Function f1(ByVal x As Integer) As String
If x \ 2 <> x / 2 Then
f1 = "是奇数"
Else
f1 = "是偶数"
End If
End Function
Private Function f2(ByVal x As Integer) As String
If x Mod 7 = 0 Then
f2 = "能被7整除"
Else
f2 = "不能被7整除"
End If
End Function
4、【
简答题】
' 提供给考生的程序
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) / 10) * Int(Arr2(i) / 10)
Sum = Sum + Arr3(i)
Next i
Print "Sum = "; Sum
End Sub
' 要求考生编写的程序
Private Sub C3_Click()
WriteData "DataOut.txt", Sum
End Sub
5、【
简答题】
[10分]
解析:
Private Sub Clea_Click()
Text1.Text = ""
End Sub
Private Sub Dis_Click()
Text1.Text = "等级考试"
End Sub
6、【
简答题】
Option Base 1
Private Sub Form_Click()
Const N = 5
Const M = 5
' Dim ?
Dim i, j, t
' Open App.Path & "\" & "datain.txt" ? As #1
For i = 1 To N
For j = 1 To M
' ?
Next j
Next i
Close #1
Print
Print "初始矩阵为:"
Print
For i = 1 To N
For j = 1 To M
Print Tab(5 * j); Mat(i, j);
Next j
Print
Next i
Print
Print
For i = 1 To N
For j = 1 To M
t = Mat(1, j)
Mat(1, j) = Mat(3, j)
' ?
Next j
Next i
Print
Print "交换第一行和第三行后的矩阵为:"
Print
For i = 1 To N
For j = 1 To M
Print Tab(5 * j); Mat(i, j);
Next j
Print
Next i
End Sub
[10分]
解析:
Option Base 1
Private Sub Form_Click()
Const N = 5
Const M = 5
Dim Mat(M, N) As Integer
Dim i, j, t
Open App.Path & "\" & "datain.txt" For Input As #1
For i = 1 To N
For j = 1 To M
Input #1, Mat%(i, j)
Next j
Next i
Close #1
Print
Print "初始矩阵为:"
Print
For i = 1 To N
For j = 1 To M
Print Tab(5 * j); Mat(i, j);
Next j
Print
Next i
Print
Print
For i = 1 To N
For j = 1 To M
t = Mat(1, j)
Mat(1, j) = Mat(3, j)
Mat%(3, j) = t
Next j
Next i
Print
Print "交换第一行和第三行后的矩阵为:"
Print
For i = 1 To N
For j = 1 To M
Print Tab(5 * j); Mat(i, j);
Next j
Print
Next i
End Sub
7、【
简答题】
[10分]
解析:
Private Sub Form_Click()
If Op1 Then
Text3.Text = Text1.Text
Text1.Text = Text2.Text
Text2.Text = Text3.Text
Text3.Text = "交换成功"
ElseIf Op2 Then
Text3.Text = Text1.Text & Text2.Text
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Open App.Path & "\out4.txt" For Output As #1
Print #1, Op1.Value, Op2.Value, Text1.Text, Text2.Text, Text3.Text
Close #1
End Sub
8、【
简答题】
[10分]
解析:
Private Sub Dis_Click()
Text1.Text = "等级考试"
End Sub
Private Sub Hid_Click()
Text1.Visible = False
End Sub
9、【
简答题】
[10分]
解析:
Private Sub L1_DblClick()
L1.AddItem Text1.Text
End Sub
10、【
简答题】
'Private Flag As ?
Private Sub Form_Click()
If Flag Then
Shape1.Top = Shape2.Top
Shape1.Left = Shape2.Left
Flag = Not (Flag)
Else
' Shape1.Top = Shape2.Top + Shape2.Height - ?
' Shape1.Left = Shape2.Left + Shape2.Width - ?
Flag = Not (Flag)
End If
End Sub
Private Sub Form_Load()
Flag = True
End Sub
[10分]
解析:
Private Flag As Boolean
Private Sub Form_Click()
If Flag Then
Shape1.Top = Shape2.Top
Shape1.Left = Shape2.Left
Flag = Not (Flag)
Else
Shape1.Top = Shape2.Top + Shape2.Height - Shape1.Height
Shape1.Left = Shape2.Left + Shape2.Width - Shape1.Width
Flag = Not (Flag)
End If
End Sub
Private Sub Form_Load()
Flag = True
End Sub