本栏目下题库来源于互联网,轻速云承诺对于用户导入平台的题库是严格保密的,不会在此呈现!
轻速云给您提供更好的在线考试系统服务!
二级VB上机题库15
1、【 简答题
    
Private Sub Form_Click()
    If Option1.Value = True Then
        Text1.Text = InputBox("请输入要添加的项目")
        'List1.AddItem ?
    End If
    If Option2.Value = True Then
        Text1.Text = InputBox("请输入要删除的项目")
        'For i = 0 To ?
            'If List1.List(i) = ? Then
                'List1.RemoveItem ?
            End If
        Next i
    End If
End Sub [10分]
解析:
Private Sub Form_Click()
    If Option1.Value = True Then
        Text1.Text = InputBox("请输入要添加的项目")
        List1.AddItem Text1.Text
    End If
    If Option2.Value = True Then
        Text1.Text = InputBox("请输入要删除的项目")
        For i = 0 To List1.ListCount - 1
            If List1.List(i) = Text1.Text Then
                List1.RemoveItem i
            End If
        Next i
    End If
End Sub
2、【 简答题
    
' 提供给考生的程序
Option Base 1
Dim Arr(100) As Integer
' 提供给考生的程序
Sub ReadData()
    Open App.Path & "\" & "datain1.txt" For Input As #1
        For i = 1 To 100
        Input #1, Arr(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 Read_Click()
    ReadData
End Sub
' 要求考生编写的程序
Private Sub Calc_Click()
    Dim S As String
    Sum = 0
    For i = 1 To 100
        If Arr(i) < 50 Then
            Sum = Sum + Arr(i)
            S = S & Str(Arr(i)) & "  "
        End If
    Next i
    Text1.Text = S
    Print "Sum = "; Sum
End Sub
' 要求考生编写的程序
Private Sub Save_Click()
    WriteData "DataOut.txt", Sum
End Sub
3、【 简答题
    [10分]
解析:
Private Sub Add_Click()
        Text1.Text = InputBox("请输入要添加的项目")
        'List1.AddItem ?
        List1.AddItem Text1.Text
End Sub
Private Sub Delete_Click()
    Text1.Text = InputBox("请输入要删除的项目")
    'For i = 0 To ?
    For i = 0 To List1.ListCount - 1
        'If List1.List(i) = ? Then
        If List1.List(i) = Text1.Text Then
            'List1.RemoveItem ?
            List1.RemoveItem i
        End If
    Next i
End Sub
4、【 简答题
    [10分]
解析:
Private Sub Command1_Click()
    Label1.Visible = 0
    Text1.Visible = 0
    Print Text1.Text
End Sub
5、【 简答题
    
Option Base 1
Private Sub Sort(a() As Integer)
    Dim Start As Integer, Finish As Integer
    Dim i As Integer, j As Integer, t As Integer
    'Start = ?(a)
    'Finish = ?(a)
    'For i = ? To 2 Step -1
        'For j = 1 To ?
            'If a(j) ? a(j + 1) Then
                t = a(j + 1)
                a(j + 1) = a(j)
                a(j) = t
            End If
        Next j
    Next i
End Sub
Private Sub Command1_Click()
    Dim arr1
    Dim arr2(4) As Integer
    arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
    For i = 1 To 4
        arr2(i) = CInt(arr1(i))
    Next i
    Sort arr2()
    Text1.Text = arr2(1)
    Text2.Text = arr2(2)
    Text3.Text = arr2(3)
    Text4.Text = arr2(4)
End Sub [10分]
解析:
Option Base 1
Private Sub Sort(a() As Integer)
    Dim Start As Integer, Finish As Integer
    Dim i As Integer, j As Integer, t As Integer
    Start = LBound(a)
    Finish = UBound(a)
    For i = UBound(a) To 2 Step -1
        For j = 1 To i - 1
            If a(j) > a(j + 1) Then
                t = a(j + 1)
                a(j + 1) = a(j)
                a(j) = t
            End If
        Next j
    Next i
End Sub
Private Sub Command1_Click()
    Dim arr1
    Dim arr2(4) As Integer
    arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
    For i = 1 To 4
        arr2(i) = CInt(arr1(i))
    Next i
    Sort arr2()
    Text1.Text = arr2(1)
    Text2.Text = arr2(2)
    Text3.Text = arr2(3)
    Text4.Text = arr2(4)
End Sub
6、【 简答题
    [10分]
解析:
Private Sub HScroll1_Change()
    Text1.Width = HScroll1.Value * 1.2
    Text1.Height = Me.HScroll1.Value
End Sub
7、【 简答题
    
Option Base 1
Private Sub Sort(a() As Integer)
    Dim Start As Integer, Finish As Integer
    Dim i As Integer, j As Integer, t As Integer
    'Start = ?(a)
    'Finish = ?(a)
    'For i = ? To 2 Step -1
        'For j = 1 To ?
            'If a(j) ? a(j + 1) Then
                t = a(j + 1)
                a(j + 1) = a(j)
                a(j) = t
            End If
        Next j
    Next i
End Sub
Private Sub Command1_Click()
    Dim arr1
    Dim arr2(4) As Integer
    arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
    For i = 1 To 4
        arr2(i) = CInt(arr1(i))
    Next i
    Sort arr2()
    Text1.Text = arr2(1)
    Text2.Text = arr2(2)
    Text3.Text = arr2(3)
    Text4.Text = arr2(4)
End Sub [10分]
解析:
Option Base 1
Private Sub Sort(a() As Integer)
    Dim Start As Integer, Finish As Integer
    Dim i As Integer, j As Integer, t As Integer
    Start = LBound(a)
    Finish = UBound(a)
    For i = Finish To 2 Step -1
        For j = 1 To i - 1
            If a(j) < a(j + 1) Then
                t = a(j + 1)
                a(j + 1) = a(j)
                a(j) = t
            End If
        Next j
    Next i
End Sub
Private Sub Command1_Click()
    Dim arr1
    Dim arr2(4) As Integer
    arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
    For i = 1 To 4
        arr2(i) = CInt(arr1(i))
    Next i
    Sort arr2()
    Text1.Text = arr2(1)
    Text2.Text = arr2(2)
    Text3.Text = arr2(3)
    Text4.Text = arr2(4)
End Sub
8、【 简答题
    [10分]
解析:
Private Sub HScroll1_Change()
    Text1.FontSize = Form1.HScroll1.Value
End Sub
1
1页,共8个题库
1页,共8个题库
轻速云给您提供更好的在线考试系统服务!
推荐
推荐题库
众多企事业单位的信赖之选
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