本栏目下题库来源于互联网,轻速云承诺对于用户导入平台的题库是严格保密的,不会在此呈现!
轻速云给您提供更好的在线考试系统服务!
二级VB上机题库24
1、【 简答题
    
Option Base 1
Dim s As String
Private Sub Command1_Click()
    Open App.Path & "\in5.dat" For Input As #1
    s = Input(LOF(1), #1)
    Close #1
End Sub
Private Sub Command2_Click()
' 考生编写
??????
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text1.Text, Text2.Text
    Close #1
End Sub [10分]
解析:
  Dim a(26) As Integer
  n = Len(s)
  For i = 1 To n
      c = UCase(Mid(s, i, 1))
      If c >= "A" And c <= "Z" Then
        j = Asc(c) - Asc("A") + 1
        a(j) = a(j) + 1
      End If
  Next i
  Max = a(1)
  t = Chr(Asc("A"))
  For i = 2 To 26
      If a(i) > Max Then
        Max = a(i)
        t = Chr(Asc("A") + i - 1)
      End If
  Next i
  Text1.Text = t
  Text2.Text = Max
2、【 简答题
    
Private Sub C1_Click(Index As Integer)
    Select Case Index
        Case ?
            Timer1.Enabled = False
        Case 0
            Timer1.Enabled = ?
    End Select
End Sub
Private Sub Timer1_Timer()
    Text1.Text = ?
End Sub [10分]
解析:
Private Sub C1_Click(Index As Integer)
    Select Case Index
        Case 1
            Timer1.Enabled = False
        Case 0
            Timer1.Enabled = True
    End Select
End Sub
Private Sub Timer1_Timer()
    Text1.Text = Text1.Text + 1
End Sub
3、【 简答题
    
Dim s As Integer, h As Long
Private Sub Form_Load()
' Timer1.Enabled = ?
  s = -40
End Sub
Private Sub Timer1_Timer()
  Shape1.Move Shape1.Left, Shape1.Top + s
'  If Shape1.Top = ? Then
    s = -s
  End If
'  If Shape1.Top + ? = Line2.Y1 Then
    s = -s
  End If
End Sub [10分]
解析:
'True
'Line1.Y1
'Shape1.Height
4、【 简答题
    [10分]
解析:
  按要求解答即可
5、【 简答题
    [10分]
解析:
  按要求解答即可
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
    For i = 1 To N
        For j = 1 To M
            t = Mat(i, 2)
            Mat(i, 2) = Mat(i, 4)
'            ?
        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
    For i = 1 To N
        For j = 1 To M
            t = Mat(i, 2)
            Mat(i, 2) = Mat(i, 4)
            Mat%(i, 4) = 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、【 简答题
    
Dim a(100) As Integer
Private Sub Command1_Click()
    Dim k As Integer
    Open App.Path & "\in4.dat" For Input As #1
    For k = 1 To 100
        Input #1, a(k)
    Next k
    Close #1
End Sub
Private Sub Command2_Click()
'考生编写
  ???
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out4.dat" For Output As #1
    Print #1, Combo1.Text; Text1.Text
    Close #1
End Sub
Function even()
    Dim s As Single, n As Integer
    s = 0
    For k = 1 To 100
        If a(k) / 2 = Fix(a(k) / 2) Then
          s = s + a(k)
          n = n + 1
        End If
    Next
    s = s / n
    even = CInt(s)
End Function
Function odd()
    Dim s As Single, n As Integer
    s = 0
    For k = 1 To 100
        If a(k) / 2 <> Fix(a(k) / 2) Then
          s = s + a(k)
          n = n + 1
        End If
    Next
    s = s / n
    odd = CInt(s)
End Function
Function all()
    Dim s As Single, n As Integer
    s = 0
    For k = 1 To 100
      s = s + a(k)
    Next
    s = s / 100
    all = CInt(s)
End Function [10分]
解析:
    Select Case Combo1.ListIndex
        Case 0
            Text1 = even()
        Case 1
            Text1 = odd()
        Case 2
            Text1 = all()
    End Select
End Sub
8、【 简答题
    [10分]
解析:
Private Sub Cmd1_Click()
  Line4.Visible = True
End Sub
Private Sub Cmd2_Click()
  Line4.Visible = False
End Sub
9、【 简答题
    [10分]
解析:
Private Sub HScroll1_Change()
  Text1.Text = HScroll1.Value
End Sub
10、【 简答题
    
Dim s As Integer
Private Sub Command1_Click()
s = Val(InputBox("输入里程数(单位:公里)"))
End Sub
Private Sub Command2_Click()
  If s > 0 Then
    'Select Case  ?
      Case Is <= 4
        '?
      Case Is <= 15
        ' f = 10 + ?
      '?
        ' f = 10 + ? + (s - 15) * 1.8
    End Select
    Text1.Text = f
  Else
    MsgBox "请单击“输入”按钮输入里程数!"
  End If
End Sub [10分]
解析:
Dim s As Integer
Private Sub Command1_Click()
s = Val(InputBox("输入里程数(单位:公里)"))
End Sub
Private Sub Command2_Click()
  If s > 0 Then
    Select Case s
      Case Is <= 4
        f = 10
      Case Is <= 15
        f = 10 + (s - 4) * 1.2
      Case Else
        f = 10 + (15 - 4) * 1.2 + (s - 15) * 1.8
    End Select
    Text1.Text = f
  Else
    MsgBox "请单击“输入”按钮输入里程数!"
  End If
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