计算机类二级VB

二级VB上机题库11

10 题含答案VB
共 10 题返回本类
1材料分析题1 / 10
  
查看答案
Private Sub Command1_Click()
    CD1.ShowOpen
End Sub
2材料分析题2 / 10
  
查看答案
Private Sub C1_Click()
    T1.Enabled = True
End Sub
Private Sub T1_Timer()
    Text1.Text = Text1.Text + 1
End Sub
4材料分析题4 / 10
   
Private Sub C1_Click()
    Dim k As Integer
    For k = 0 To 2
'        If Op1(k).? = True Then
'            Call draw(?)
        End If
    Next k
End Sub
Sub draw(a As Integer)
    P1.Print "选择了" & Op1(a).Caption
End Sub
查看答案
Private Sub C1_Click()
    Dim k As Integer
    For k = 0 To 2
        If Op1(k).Value = True Then
            Call draw(k)
        End If
    Next k
End Sub
Sub draw(a As Integer)
    P1.Print "选择了" & Op1(a).Caption
End Sub
5材料分析题5 / 10
   
Private Function IsPrime(ByVal x As Integer) As Boolean
    Dim i As Integer
    For i = 2 To Sqr(x)
        If x Mod i = 0 Then
            IsPrime = False
            Exit Function
        End If
    Next
    IsPrime = True
End Function
Private Sub Command1_Click()
'考生编写程序开始
'======================================
  ????
'=========================================
'考生编写程序结束
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text1.Text, Label1(0).Caption, Label1(1).Caption, Label1(2).Caption
    Close #1
End Sub
查看答案
    Dim i As Integer
    Dim n As Integer
    Dim counter As Integer
    Dim arr(3) As Integer
    n = Val(Text1.Text)
    counter = 0
    For i = n - 2 To 3 Step -2
        If IsPrime(i) Then
            arr(counter) = i
            counter = counter + 1
            If counter = 3 Then
                Exit For
            End If
        End If
    Next
    For i = 0 To 2
        Label1(i).Caption = arr(i)
    Next
7材料分析题7 / 10
  
查看答案
Private Sub Text1_Change()
    P1.Print Text1.Text                    'Text1.Text前可以加Me或Form1
'或    Text1.Parent.P1.Print Text1.Text    Text1.Text前可以加Me或Form1
'或    Me.P1.Print Text1.Text              Text1.Text前可以加Me或Form1
'或    Form1.P1.Print Text1.Text            Text1.Text前可以加Me或Form1
End Sub
8材料分析题8 / 10
   
'提供给考生
'Private Sub C1_Click()
''    For i = ? To ?
''        If Op1(i).? = True Then
''            Print "我的出生地是" + Op1(i).?
'        End If
'    Next
'End Sub
查看答案

Private Sub C1_Click()
    For i = 0 To 2
        If Op1(i).Value = True Then
            Print "我的出生地是" + Op1(i).Caption
        End If
    Next
End Sub
9材料分析题9 / 10
   
'提供给考生的程序
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out4.txt" For Output As #1
    Print #1, Cb1.Text, Cb2.Text, CInt(L1.Font.Size), L1.Font
    Close #1
End Sub
查看答案
'要求考生编写的程序
Private Sub Cb1_Click()
    L1.Font.Size = Cb1.Text
End Sub
Private Sub Cb2_Click()
    L1.Font = Cb2.Text
End Sub
10材料分析题10 / 10
   
'提供给考生的程序
Private Function isprime(a As Integer) As Boolean
    Dim flag As Boolean
    flag = True
    b% = 2
    Do While b% <= Int(a / 2) And flag
        If Int(a / b%) = a / b% Then
            flag = False
        Else
            b% = b% + 1
        End If
    Loop
    isprime = flag
End Function
查看答案
'要求考生编写的程序
Private Sub C1_Click()
    a% = 15000
    Do
        a% = a% + 1
    Loop Until isprime(a%)
    Text1.Text = a%
End Sub
Private Sub C2_Click()
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, Text1.Text
    Close #1
End Sub
← 上一卷下一卷 →