本栏目下题库来源于互联网,轻速云承诺对于用户导入平台的题库是严格保密的,不会在此呈现!
轻速云给您提供更好的在线考试系统服务!
二级VB上机题库4
1、【 简答题
   
    
Private Type Tele
    Name As String * 15
    Tel As String * 15
    Pos As Long
End Type
Dim Pers As Tele
Dim RecNum As Integer
Private Sub Command1_Click()
    Open "t5.txt" For Random As #1 Len = Len(Pers)
    RecNum = LOF(1) / Len(Pers)
    Do
        Pers.Name = InputBox("请输入姓名")
        Pers.Tel = InputBox("请输入电话")
        Pers.Pos = InputBox("请输入邮政编码")
'        RecNum = ?
'        Put #1, ?
        asp = InputBox("More(Y/N)?")
'    Loop While UCase(asp) ?
    Close 1
End Sub
Private Sub Command2_Click()
    Open "t5.txt" For Random As #1 Len = Len(Pers)
'    RecNum = ?
    Cls
    For i = 1 To RecNum
'        Get #1, ?
        Print Pers.Name; Pers.Tel; Pers.Pos
    Next i
    Close 1
End Sub [10分]
解析:
Private Type Tele
    Name As String * 15
    Tel As String * 15
    Pos As Long
End Type
Dim Pers As Tele
Dim RecNum As Integer
Private Sub Command1_Click()
    Open "t5.txt" For Random As #1 Len = Len(Pers)
    RecNum = LOF(1) / Len(Pers)
    Do
        Pers.Name = InputBox("请输入姓名")
        Pers.Tel = InputBox("请输入电话")
        Pers.Pos = InputBox("请输入邮政编码")
        RecNum = RecNum + 1
        Put #1, RecNum, Pers
        asp = InputBox("More(Y/N)?")
    Loop While UCase(asp) <> "N"
    Close 1
End Sub
Private Sub Command2_Click()
    Open "t5.txt" For Random As #1 Len = Len(Pers)
    RecNum = LOF(1) / Len(Pers)
    Cls
    For i = 1 To RecNum
        Get #1, i, Pers
        Print Pers.Name; Pers.Tel; Pers.Pos
    Next i
    Close 1
End Sub
2、【 简答题
    [10分]
解析:
Private Type StudInfo
    Name As String * 8
    Sex As String * 4
    Age As Integer
End Type
Dim Stud As StudInfo
Dim RecNum As Long
Private Sub Command1_Click()
    Open App.Path & "\in5.txt" For Random As #1 Len = Len(Stud)
    RecNum = 1
    Do While Not EOF(1)
        Get #1, RecNum, Stud
        Text1.Text = Text1.Text & Stud.Name
        Text1.Text = Text1.Text & Stud.Sex
        Text1.Text = Text1.Text & Str(Stud.Age)
        Text1.Text = Text1.Text + vbCrLf
        RecNum = RecNum + 1
    Loop
    Close 1
End Sub
Private Sub Command2_Click()
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, Text1.Text
    Close 1
End Sub
3、【 简答题
    [10分]
解析:
Private Sub Command1_Click()
    Command1.Caption = Label1
    Label1.Visible = False
End Sub
4、【 简答题
   Private Sub Command1_Click()
    For i = 0 To 3
        ' If  ? = True Then
            opt = Option1(i).Caption
        End If
    Next
    ' Select Case ?
    Case "+"
        Result = HScroll1.Value + HScroll2.Value
      Case "-"
        Result = HScroll1.Value - HScroll2.Value
      Case "*"
        Result = HScroll1.Value * HScroll2.Value
      Case "/"
        Result = HScroll1.Value / HScroll2.Value
    End Select
    '  ? = Str(HScroll1.Value) & " " & opt & Str(HScroll2.Value) & " =" & Str(Result)
End Sub [10分]
解析:
Private Sub Command1_Click()
    For i = 0 To 3
        If Option1(i) = True Then
            opt = Option1(i).Caption
        End If
    Next
    Select Case opt
    Case "+"
        Result = HScroll1.Value + HScroll2.Value
      Case "-"
        Result = HScroll1.Value - HScroll2.Value
      Case "*"
        Result = HScroll1.Value * HScroll2.Value
      Case "/"
        Result = HScroll1.Value / HScroll2.Value
    End Select
    Label4 = Str(HScroll1.Value) & " " & opt & Str(HScroll2.Value) & " =" & Str(Result)
End Sub
5、【 简答题
    [10分]
解析:
Private Sub C1_Click()
    T1 = "等级考试"
End Sub
Private Sub C2_Click()
    T1.Height = 2 * Me.T1.Height
    T1.Width = 2 * T1.Width
    T1.FontSize = 3 * Form1.T1.FontSize
End Sub
6、【 简答题
    [10分]
解析:
Private Sub Command1_Click()
    If Option1.Value And List1.Text <> "" Then
        Text1.Text = List1.Text & Option1.Caption
    Else
        If Option2.Value And List1.Text <> "" Then
            Text1.Text = List1.Text & Option2.Caption
        End If
    End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out3.txt" For Output As #1
    Print #1, Form1.List1.Text, Form1.Option1.Value, Form1.Option2.Value, Form1.Text1.Text
    Close #1
End Sub
7、【 简答题
   
Private Sub Command1_Click()
    Dim i As Integer, j As Integer, iSum As Integer
    Print "连续和为1250的正整数是:"
    For i = 1 To 500
        ' iSum = ?
        For j = i To 500
            ' iSum = ?
            If iSum >= 1250 Then Exit For
        Next
        'If  iSum = ? Then
            Print i; " ~ "; j
        End If
    Next
End Sub [10分]
解析:
Private Sub Command1_Click()
    Dim i As Integer, j As Integer, iSum As Integer
    Print "连续和为1250的正整数是:"
    For i = 1 To 500
        iSum = 0
        For j = i To 500
            iSum = iSum + j
            If iSum >= 1250 Then Exit For
        Next
        If iSum = 1250 Then
            Print i; " ~ "; j
        End If
    Next
End Sub
8、【 简答题
    [10分]
解析:
Private Sub C1_Click()
    Text1.Text = LCase(Text1.Text)
    Text2.Text = UCase(Text1.Text)
End Sub
9、【 简答题
    [10分]
解析:
Private Sub Op1_Click()
    Text1 = "颐和园"
End Sub
Private Sub Op2_Click()
    Text1.Text = "兵马俑"
End Sub
Private Sub Op3_Click()
    Text1.Text = "西湖"
End Sub
10、【 简答题
   Private Sub Command1_Click()
    Dim m As Integer, n As Integer
    Do
        n = Val(InputBox("请输入月份"))
    '  Loop Until ? And n < 13
    '  Select Case ?
        Case 1, 2, 3
            m = 1
        Case 4, 5, 6
            m = 2
        Case 7, 8, 9
            m = 3
        Case 10, 11, 12
            m = 4
    End Select
    ' Select Case ?
        Case 1
            Text1.Text = Str(n) & " 月份是春季"
        Case 2
            Text1.Text = Str(n) & " 月份是夏季"
        Case 3
            Text1.Text = Str(n) & " 月份是秋季"
        Case Else
            Text1.Text = Str(n) & " 月份是冬季"
      End Select
End Sub [10分]
解析:
Private Sub Command1_Click()
    Dim m As Integer, n As Integer
    Do
        n = Val(InputBox("请输入月份"))
    Loop Until n > 0 And n < 13
    Select Case n
        Case 1, 2, 3
            m = 1
        Case 4, 5, 6
            m = 2
        Case 7, 8, 9
            m = 3
        Case 10, 11, 12
            m = 4
    End Select
    Select Case m
        Case 1
            Text1.Text = Str(n) & " 月份是春季"
        Case 2
            Text1.Text = Str(n) & " 月份是夏季"
        Case 3
            Text1.Text = Str(n) & " 月份是秋季"
        Case Else
            Text1.Text = Str(n) & " 月份是冬季"
      End Select
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