本栏目下题库来源于互联网,轻速云承诺对于用户导入平台的题库是严格保密的,不会在此呈现!
轻速云给您提供更好的在线考试系统服务!
二级VB上机题库32
1、【 简答题
    
Private Sub Command1_Click()
  Open App.Path & "\in5.dat" For Input As #1
  s = Input(LOF(1), #1)
  Close #1
  Text1.Text = s
End Sub
Private Sub Command2_Click()
'  If Len(s) =  ?  Then
      MsgBox "请先使用“读数据”功能!"
  Else
      t = ""
      For i = 1 To Len(s)
        c = Mid(s, i, 1)
'        If  ?  <> " " Then
          t = t + c
        Else
'          ?  = LCase(t)
          If InStr(x, "t") <> 0 And InStr(x, "h") <> 0 And InStr(x, "e") <> 0 Then
'              m =  ?
          End If
          t = ""
        End If
      Next i
      Text2.Text = m
  End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text2.Text
    Close #1
End Sub [10分]
解析:
Private Sub Command1_Click()
  Open App.Path & "\in5.dat" For Input As #1
  s = Input(LOF(1), #1)
  Close #1
  Text1.Text = s
End Sub
Private Sub Command2_Click()
  If Len(s) = 0 Then
      MsgBox "请先使用“读数据”功能!"
  Else
      t = ""
      For i = 1 To Len(s)
        c = Mid(s, i, 1)
        If c <> " " Then
          t = t + c
        Else
          x = LCase(t)
          If InStr(x, "t") <> 0 And InStr(x, "h") <> 0 And InStr(x, "e") <> 0 Then
              m = m + 1
          End If
          t = ""
        End If
      Next i
      Text2.Text = m
  End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text2.Text
    Close #1
End Sub
2、【 简答题
    
Private Sub Command1_Click()
'  Text1.Enabled =  ?
  Text1.SetFocus
End Sub
Private Sub Command2_Click()
  If Text1.Enabled = False Then
      MsgBox "请先使用“输入密码”功能!"
  Else
'      If Text1 <>    "?"  Then
          n = n + 1
'          If  ?  = 3 Then
              MsgBox "三次密码输入错误,你无权进入本系统!"
              End
          Else
              MsgBox "第" + Str(n) + "次密码输入错误,请重试!"
              Text1 = ""
              Text1.SetFocus
          End If
        Else
          Text1.Enabled = False
          Text1 = ""
'          ?.Hide
'          ?.Show
        End If
  End If
End Sub
Private Sub Command1_Click()
  Form2.Hide
  Form1.Show
End Sub [10分]
解析:
  Text1.Enabled = True
      If Text1 <> "abc" Then
'          If n = 3 Then 或          If n >= 3 Then
          Form1.Hide
          Form2.Show
3、【 简答题
    
Private Sub Command1_Click()
    Dim k As Integer
    Open App.Path & "\in5.dat" For Input As #1
    For k = 1 To 100
        Input #1, a(k)
        Text1 = Text1 + Str(a(k)) + Space(1)
    Next k
    Close #1
End Sub
Private Sub Command2_Click()
  Dim b(100) As Integer
  num = 0
      If Len(Text1.Text) = 0 Then
        MsgBox "请先执行“读数据”功能!"
  Else
      '考生编写(功能:生成 b 数组,且按从小到大顺序排序)
      '注意:请务必将数组 b 的元素个数存入变量 num 中
=====================
???
=====================
      '以下程序段将已排序的 b 数组显示在Text2中
      For i = 1 To num
          Text2.Text = Text2.Text + Str(b(i)) + Space(2)
      Next i
  End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text2.Text
    Close #1
End Sub [10分]
解析:
      For i = 1 To 100
          If a(i) / 3 = Fix(a(i) / 3) Then
            num = num + 1
            b(num) = a(i)
          End If
      Next
      For i = 1 To num - 1
          For j = i + 1 To num
            If b(i) > b(j) Then
                tem = b(i)
                b(i) = b(j)
                b(j) = tem
            End If
          Next
      Next
4、【 简答题
    [10分]
解析:
  按要求解答即可
5、【 简答题
    [10分]
解析:
  按要求解答即可
6、【 简答题
    
Private Sub Cmd_Click(Index As Integer)
'    Select Case  ?
      Case 0
'          Timer1.Enabled =  ?
          Cmd(1).Enabled = True
          If Cmd(0).Caption = "开始" Then
              Cmd(0).Caption = "继续"
          End If
'          Cmd(0).Enabled =  ?
      Case 1
          Timer1.Enabled = False
          Cmd(0).Enabled = True
          Cmd(1).Enabled = False
      Case 2
          End
    End Select
End Sub
Private Sub Timer1_Timer()
    t(3) = t(3) + 1
'    If t(3) =  ?  Then
        t(3) = 0
        t(2) = t(2) + 1
        If t(2) = 60 Then
          t(2) = 0
          t(1) = t(1) + 1
        End If
    End If
    For i = 1 To 3
'        Text(  ?  ).Text = t(i)
    Next
End Sub [10分]
解析:
    Select Case Index
          Timer1.Enabled = True
          Cmd(0).Enabled = False
    If t(3) = 60 Then
        Text(i - 1).Text = t(i)
7、【 简答题
    
Private Sub Command1_Click()
  Open App.Path & "\in4.dat" For Input As #1
  s = Input(LOF(1), #1)
  Close #1
  Text1.Text = s
End Sub
Private Sub Command2_Click()
  Dim m As Integer
'  If Len(s) =  ?    Then
    MsgBox "请先使用“读数据”功能!"
  Else
'    If Text1.?    = 0 Then
        MsgBox "请先选中文本!"
    Else
        t = ""
        For i = 1 To Text1.SelLength
          c = Mid(Text1.SelText, i, 1)
          If c <> " " Then
              t = t + c
          Else
'              If  ?  = "the" Then
                m = m + 1
              End If
              t = ""
          End If
        Next i
'        ?  = Str(m)
    End If
  End If
End Sub [10分]
解析:
  If Len(s) = 0 Then
    If Text1.SelLength = 0 Then
              If LCase(t) = "the" Then
        Text2.Text = Str(m)
8、【 简答题
    [10分]
解析:
Private Sub Command1_Click()
  Text1.Alignment = 0
End Sub
Private Sub Command2_Click()
  Text1.Alignment = 2
End Sub
Private Sub Command3_Click()
  Text1.Alignment = 1
End Sub
9、【 简答题
    [10分]
解析:
Private Sub Command1_Click()
  Label1.FontSize = Label1.FontSize + 2
'或  Label1.Font.Size = Label1.FontSize + 2
'或  Label1.FontSize = Label1.Font.Size + 2
'或  Label1.Font.Size = Label1.Font.Size + 2
'或  Label1.FontSize = 2 + Label1.FontSize
'或  Label1.Font.Size = 2 + Label1.FontSize
'或  Label1.FontSize = 2 + Label1.Font.Size
'或  Label1.Font.Size = 2 + Label1.Font.Size
End Sub
Private Sub Command2_Click()
  Label1.FontSize = 12
'或  Label1.Font.Size = 12
End Sub
10、【 简答题
    
Private Sub Command1_Click()
    Open App.Path & "\in4.dat" For Input As #1
    For i = 1 To 20
      For j = 1 To 5
          Input #1, a(i, j)
          Text1 = Text1 + Str(a(i, j)) + Space(2)
      Next j
    Next i
    Close #1
End Sub
Private Sub Command2_Click()
'考生编写
==================
???
==================
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out4.dat" For Output As #1
    Print #1, Text2.Text
    Close #1
End Sub [10分]
解析:
  If Len(Text1) = 0 Then
      MsgBox "请先执行“读数据”功能!"
  Else
      For i = 1 To 20
        Max = a(i, 1)
        For j = 2 To 5
            If a(i, j) > Max Then Max = a(i, j)
        Next j
        s = s + Max
      Next i
      Avg = s / 20
      Text2 = Avg
  End If
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