本栏目下题库来源于互联网,轻速云承诺对于用户导入平台的题库是严格保密的,不会在此呈现!
轻速云给您提供更好的在线考试系统服务!
二级VB上机题库9
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
1
1页,共10个题库
1页,共10个题库
轻速云给您提供更好的在线考试系统服务!
推荐
推荐题库
众多企事业单位的信赖之选
36万+企事业单位的共同选择
查看更多合作案例
众多企事业单位的信赖之选
开始使用轻速云组织培训考试
四步组织一场考试答题,一键搭建企业培训平台
免费使用 免费使用 预约演示
咨询热线
400-886-8169
周一到周日 8:00-22:00
©2023 轻速云 苏ICP备16049646号-1 轻速云科技提供专业的在线考试系统、在线培训系统
联系我们
客服热线客服热线:400-886-8169 | 周一至周日 8:00-22:00
©2023 轻速云 苏ICP备16049646号-1
轻速云科技提供专业的在线考试系统、在线培训系统
在线咨询 400-886-8169