计算机类二级VB

二级VB上机题库31

10 题含答案VB
共 10 题返回本类
1材料分析题1 / 10
  
查看答案
Private Sub C1_Click()
    Form1.BackColor = &HFF&
End Sub
3材料分析题3 / 10
   
Private Sub Command1_Click()
    Dim i As Integer
    For i = 0 To 1
        If Option1.Item(i) = True Then
'          Call ?
'          Label2.Caption = ?
        End If
    Next
End Sub
Private Sub calc(c As Integer)
    Dim i As Integer
    result = 0
'    x = ?
    If c = 0 Then
        For i = 1 To x
'            If ? <> 0 Then
                result = result + i
            End If
        Next
    Else
        For i = 1 To x
            If i Mod 2 = 0 Then
                result = result + i
            End If
        Next
    End If
'    Label3.Caption = ?
End Sub
查看答案
          Call calc(i)
          Label2.Caption = Option1(i).Caption
    x = Val(Text1.Text)
            If i Mod 2 <> 0 Then
    Label3.Caption = result
4材料分析题4 / 10
   
Private Sub Command1_Click()
    Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
'    Timer1.Enabled = ?
End Sub
Private Sub Form_Load()
'    Timer1.Interval =?
End Sub
Private Sub Timer1_Timer()
    Picture1.Left = Picture1.Left + 200
'    If Picture1.Left > ? Then
'        Picture1.Left = ?
    End If
    HScroll1.Value = Picture1.Left
End Sub
查看答案
    Timer1.Enabled = 0
    Timer1.Interval = 500
    If Picture1.Left >= Form1.Width Then
        Picture1.Left = 0
5材料分析题5 / 10
   
Private arr(100) As Integer
Private n As Integer
Private Sub Command2_Click()
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, Text1.Text
    Print #1, Text2.Text
    Print #1, Text3.Text
    Print #1, Text4.Text
    Print #1, Text5.Text
    Print #1, Text6.Text
    Close #1
    MsgBox "保存成功!"
End Sub
Private Sub Form_Load()
    Open App.Path & "\in5.txt" For Input As #1
    n = 0
    Do While Not EOF(1)
        Input #1, x
        n = n + 1
        arr(n) = x
    Loop
    Close #1
End Sub
Private Sub Command1_Click()
'========以下考生编写程序开始=======
????
'======"考生编写程序结束"=======================
End Sub
查看答案
    Text1.Text = n
    count1 = 0
    count2 = 0
    count3 = 0
    count4 = 0
    count5 = 0
    count6 = 0
    For i = 1 To n
        y = Int(arr(i) / 10)
        Select Case y
            Case 1, 2, 3, 4, 5
                count1 = count1 + 1
            Case 6
                count2 = count2 + 1
            Case 7
                count3 = count3 + 1
            Case 8
                count4 = count4 + 1
            Case 9, 10
                count5 = count5 + 1
        End Select
    Next
    Text2.Text = count1
    Text3.Text = count2
    Text4.Text = count3
    Text5.Text = count4
    Text6.Text = count5
9材料分析题9 / 10
   
Private Sub Command1_Click()
    Dim i As Integer
    For i = 0 To 1
        If Option1.Item(i) = True Then
'          Call ?
'          Label2.Caption = ?
        End If
    Next
End Sub
Private Sub calc(c As Integer)
    Dim i As Integer
    result = 0
'    x = ?
    If c = 0 Then
        For i = 1 To x
'            If ? <> 0 Then
                result = result + i
            End If
        Next
    Else
        For i = 1 To x
            If i Mod 2 = 0 Then
                result = result + i
            End If
        Next
    End If
'    Label3.Caption = ?
End Sub
查看答案
          Call calc(i)
          Label2.Caption = Option1(i).Caption
    x = Val(Text1.Text)
            If i Mod 2 <> 0 Then
    Label3.Caption = result
10材料分析题10 / 10
   
Dim a(10) As Integer
Dim b(10) As Integer
Dim c(10) As Integer
Private Sub Command1_Click()
    Open App.Path & "\dataA.txt" For Input As #1
    Open App.Path & "\dataB.txt" For Input As #2
    For i = 0 To 9
        Input #1, a(i)
        Input #2, b(i)
    Next
    Close #1, #2
End Sub
'Private Sub find( x()  As Integer, t As ? )
 
'==================以下为考生编写的程序======================
??(1)??
'==================考生编写的程序结束========================
End Sub
Private Sub Command2_Click()
'==================以下为考生编写的程序======================
??(2)??
'==================考生编写的程序结束========================
    Open App.Path & "\out51.txt" For Output As #1
    For i = 0 To 9
        Print #1, c(i)
    Next
    Close #1
End Sub
Private Sub Command3_Click()
    Call find(a, Text1)
    Call find(c, Text2)
        Open App.Path & "\out52.txt" For Output As #1
    Print #1, Text1.Text, Text2.Text
    Close #1
End Sub
查看答案
Private Sub find(x() As Integer, t As TextBox)
(1)
Max = x(0)
For i = 1 To 9
    If x(i) > Max Then
      Max = x(i)
    End If
Next i
t = Max
(2)
For i = 0 To 9
    c(i) = a(i) + b(i)
Next
← 上一卷下一卷 →