本栏目下题库来源于互联网,轻速云承诺对于用户导入平台的题库是严格保密的,不会在此呈现!
轻速云给您提供更好的在线考试系统服务!
二级VB上机题库12
1、【 简答题
    
Private arr(100) As Integer
Private Sub Command1_Click()
    Open App.Path & "\in5.txt" For Input As #1
    For i = 1 To 40
        Input #1, arr(i)
    Next
    Close #1
End Sub
Private Sub Command2_Click()
'=================考生编写程序开始===================
???
'=================考生编写程序结束====================
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, Label3.Caption, Label4.Caption
    Close #1
End Sub
Public Function prime(x As Integer)
    k = Int(Sqr(x) + 0.5)
    For i = 2 To k
        If x Mod i = 0 Then
            prime = False
            Exit Function
        End If
    Next
    If i > k Then prime = True
End Function [10分]
解析:
    n = 0
    For k = 1 To 40
        If prime(arr(k)) Then
            If n = 0 Then
                mini = arr(k)
            Else
                If mini > arr(k) Then
                    mini = arr(k)
                End If
            End If
            n = n + 1
        End If
    Next
    Label3.Caption = Str(n)
    Label4.Caption = Str(mini)
2、【 简答题
    
' 给考生的程序
Private Sub Form_Unload(Cancel As Integer)
    unload_sub
End Sub [10分]
解析:
'正确的程序
Private Sub Command1_Click()
    Dim a As Long, a1 As Long, a2 As Long
    Dim k As Integer, n As Integer
    For k = 0 To 2
        If Op1(k).Value Then
            n = Val(Op1(k).Caption)
        End If
    Next k
    a1 = 1
    a2 = 1
    For k = 3 To n
        a = a1 + a2
        a1 = a2
        a2 = a
    Next k
    Text1.Text = a
End Sub
3、【 简答题
    
Private Sub Op1_Click(Index As Integer)
''给考生的程序:
'    Dim a As String, b As String, c As String
'    a = "我坐"
'    b = "我开"
''    Select Case ?
'        Case 0
'            Text1.Text = a + Me.Op1(0).Caption + "去"
'        Case 1
''            Text1.Text = ? + Me.Op1(1).Caption + "去"
'        Case 2
'            Text1.Text = b + Me.Op1(2).Caption + "去"
'    End Select [10分]
解析:
''正确程序:
    Dim a As String, b As String, c As String
    a = "我坐"
    b = "我开"
    Select Case Index
        Case 0
            Text1.Text = a + Me.Op1(0).Caption + "去"
        Case 1
            Text1.Text = a + Me.Op1(1).Caption + "去"
        Case 2
            Text1.Text = b + Me.Op1(2).Caption + "去"
    End Select
End Sub
'答案:
'Index
'a  或  "我坐"
4、【 简答题
    [10分]
解析:
  按要求解答即可
5、【 简答题
    
''给考生的程序
'Private Sub C1_Click()
''    Timer1.Enabled = ?
'End Sub
'Private Sub Timer1_Timer()
'    Static a%
'    a = a + 1
''    If P1.Top > P2.Top + P2.? Then
'        P1.Move P1.Left, P1.Top - 5 - a, P1.Width, P1.Height
'    Else
''        Timer1.? = False
'    End If
'End Sub [10分]
解析:
''正确程序
Private Sub C1_Click()
    Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
    Static a%
    a = a + 1
    If P1.Top > P2.Top + P2.Height Then
        P1.Move P1.Left, P1.Top - 5 - a, P1.Width, P1.Height
    Else
        Timer1.Enabled = False
    End If
End Sub
'答案:
'True  或  非0数值
'Height
'Enabled
6、【 简答题
    [10分]
解析:
  按要求解答即可
7、【 简答题
    [10分]
解析:
Private Sub clear_Click()
    Text2.Text = ""
'或    Me.Text2.Text = ""
'或    Form1.Text2.Text = ""
End Sub
Private Sub copy_Click()
    Text2.Text = Text1.Text
'或    Me.Text2.Text = Text1.Text        Text1.Text前可以加Me或Form1
'或    Form1.Text2.Text = Text1.Text      Text1.Text前可以加Me或Form1
End Sub
8、【 简答题
     [10分]
解析:
Private Sub Form_Click()
    Print "单击窗体"
'或    Form1.Print "单击窗体"
'或    Me.Print "单击窗体"
End Sub
Private Sub P1_Click()
    P1.Print "单击图片框"
'或    Form1.P1.Print "单击图片框"
'或    Me.P1.Print "单击图片框"
End Sub
9、【 简答题
    
Private Function xn(a As Single, m As Integer)
    Dim i As Integer
    tmp = 1
    For i = 1 To m
    '    tmp = ?
    Next
    'xn = ?
End Function
Private Sub Command1_Click()
    Dim n As Integer
    Dim i As Integer
    Dim t As Single
    Dim s, x As Single
    n = Val(Text1.Text)
    x = Val(Text2.Text)
    z = 0
    For i = 2 To n
        t = x + i
    '    z = z +?
    Next
    'Label1.Caption = ?
    Call SaveResult
End Sub
Private Sub SaveResult()
    Open App.Path & "\out4.dat" For Output As #1
    Print #1, Label1.Caption
    Close #1
End Sub [10分]
解析:
Private Function xn(a As Single, m As Integer)
    Dim i As Integer
    tmp = 1
    For i = 1 To m
        tmp = a * tmp
    Next
    xn = tmp
End Function
Private Sub Command1_Click()
    Dim n As Integer
    Dim i As Integer
    Dim t As Single
    Dim s, x As Single
    n = Val(Text1.Text)
    x = Val(Text2.Text)
    z = 0
    For i = 2 To n
        t = x + i
        z = z + xn(t, i)
    Next
    Label1.Caption = Str(z)
    Call SaveResult
End Sub
Private Sub SaveResult()
    Open App.Path & "\out4.dat" For Output As #1
    Print #1, Label1.Caption
    Close #1
End Sub
10、【 简答题
    
'提供给考生的程序
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out4.txt" For Output As #1
    Print #1, Op1.Value, Op2.Value, Op3.Value, Op4.Value, Text1.Text
    Close #1
End Sub [10分]
解析:
'需要考生编写的程序
Private Sub C1_Click()
    Text1.Text = "我是"
    If Op1.Value Then
        Text1.Text = Text1.Text + Op1.Caption
    Else
        Text1.Text = Text1.Text + Op2.Caption
    End If
    If Op3.Value Then
        Text1.Text = Text1.Text + Op3.Caption
    Else
        Text1.Text = Text1.Text + Op4.Caption
    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