计算机类二级VB

二级VB上机题库27

10 题含答案VB
共 10 题返回本类
3材料分析题3 / 10
   
Private Sub Form_load()
    HScroll1.Min = Shape2.Left
'    HScroll1.Max = Shape2.Width + Shape2.Left - Shape1. ?
    VScroll1.Min = Shape2.Top
'    VScroll1.Max = Shape2.Height + ? - Shape1.Height
    HScroll1.Value = 1000
    VScroll1.Value = 1000
End Sub
Private Sub HScroll1_Change()
'    ? = HScroll1.Value
End Sub
Private Sub VScroll1_Change()
'    Shape1.Top = ?
End Sub
查看答案
    HScroll1.Max = Shape2.Width + Shape2.Left - Shape1.Width
    VScroll1.Max = Shape2.Height + Shape2.Top - Shape1.Height
    Shape1.Left = HScroll1.Value
    Shape1.Top = VScroll1
4材料分析题4 / 10
   
Private Sub Form_Load()
    a = 1
    t = 0
End Sub
Private Sub Timer1_Timer()
    Image1.Top = Image1.Top - a * 50
    If Image1.Top + Image1.Height <= Image2.Top + Image2.Height - 200 Then
'        ?  = False
'        d = ? - Image1.Top
        Label1 = d
        Label2 = t * Timer1.Interval / 1000
    End If
    a = a + 0.1
'    t = ?
End Sub
查看答案
      Timer1.Enabled = False 或      Timer1 = False
        d = d - Image1.Top
    t = t + 1
5材料分析题5 / 10
   
Dim a(30) As Integer, b(30) As Integer, c(60) As Integer
Private Sub Command1_Click()
    Dim k As Integer
    Open App.Path & "\in5.dat" For Input As #1
    For k = 1 To 30
        Input #1, a(k)
        Text1 = Text1 + Str(a(k)) + Space(2)
    Next k
    For k = 1 To 30
        Input #1, b(k)
        Text2 = Text2 + Str(b(k)) + Space(2)
    Next k
    Close #1
End Sub
Private Sub Command2_Click()
'考生编写程序开始
'======================================
?????
'=========================================
'考生编写程序结束
'以下程序将合并后的数组C显示在Text3中
    For k = 1 To 60
        Text3 = Text3 + Str(c(k)) + Space(2)
    Next k
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text3.Text
    Close #1
End Sub
查看答案
    ia = 1: ib = 1: ic = 1
    Do While ia <= 30 And ib <= 30
        If a(ia) < b(ib) Then
            c(ic) = a(ia): ia = ia + 1
        Else
            c(ic) = b(ib): ib = ib + 1
        End If
        ic = ic + 1
    Loop
    Do While ia <= 30
        c(ic) = a(ia): ia = ia + 1: ic = ic + 1
    Loop
    Do While ib <= 30
        c(ic) = b(ib): ib = ib + 1: ic = ic + 1
    Loop
    '以下程序将合并后的数组C显示在Text3中
    For k = 1 To 60
        Text3 = Text3 + Str(c(k)) + Space(2)
    Next k
7材料分析题7 / 10
    
'提供给考生的程序
Private Sub sub1()
    a = Text1
    If a < 18 Then
        Text2 = 0.5
    Else
        a = a - 18
        a = Int(a / 6) + 1
        Text2 = 0.5 + a * 0.15
    End If
End Sub
查看答案
'需要考生编写的程序
Private Sub Command1_Click()
    Timer1.Enabled = True
'或    Timer1 = True
End Sub
Private Sub Command2_Click()
    Timer1.Enabled = False
'或      Timer1 = False
End Sub
Private Sub Command3_Click()
    sub1
'或    Call sub1
End Sub
Private Sub Timer1_Timer()
    Text1 = Text1 + 1
'或    Text1 = 1 + Text1
'或    Text1 = Text1.Text + 1
'或    Text1 = 1 + Text1.Text
'或    Text1.Text = Text1 + 1
'或    Text1.Text = 1 + Text1
'或    Text1.Text = Text1.Text + 1
'或    Text1.Text = 1 + Text1.Text
End Sub
8材料分析题8 / 10
   
Private Sub Form_Click()
'    For i = 1 To ?
        For j = 1 To 6 - i
            Print " ";
        Next j
'        For j = 1 To ?
            Print "*";
        Next j
        Print
    Next i
    For i = 1 To 4
'        For j = 1 To ?
            Print " ";
        Next j
'        For j = 1 To ?
            Print "*";
        Next j
        Print
    Next i
End Sub
查看答案
'5
'2*i-1  或 i*2-1 或 -1+i*2  或 -1+2*i
'i + 1  或  1 + i
'9 - 2 * i  或  9 - i * 2  或  - i * 2 + 9  或  - 2 * i + 9
9材料分析题9 / 10
   
Dim d As Integer
Private Sub Command1_Click()
    Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
'    ? = False
End Sub
Private Sub Form_Load()
    d = 1
End Sub
Private Sub Timer1_Timer()
        If Option1 Then
'            Shape2.Top = ? + d * 50
'            If Shape2.Top <= Shape1.? Or Shape2.Top + Shape2.Width >= Shape1.Top + Shape1.Height Then
                d = -d
            End If
        ElseIf Option2 Then
'            Shape2.Left = ? + d * 50
            If Shape2.Left <= Shape1.Left Or Shape2.Left + Shape2.Width >= Shape1.Left + Shape1.Width Then
                d = -d
            End If
        End If
End Sub
查看答案
    Timer1 = False
            Shape2.Top = Shape2.Top + d * 50
            If Shape2.Top <= Shape1.Top Or Shape2.Top + Shape2.Width >= Shape1.Top + Shape1.Height Then
            Shape2.Left = Shape2.Left + d * 50
10材料分析题10 / 10
   
Dim a(10) As Integer, n As Integer
Private Sub Command1_Click()
    Open App.Path & "\in5.txt" For Input As #1
    While Not EOF(1)
'        n = n + ?
        Input #1, ch$, a(n)
'        List1.AddItem  ?
    Wend
    Close #1
End Sub
Private Sub Command2_Click()
查看答案
        n = n + 1
        List1.AddItem ch$
'需要考生编写的内容
    p = 0.3
    d = Int(Text1.Text / 500)
    Select Case d
        Case 0
            discount = 1
        Case 1
            discount = 0.98
        Case 2
            discount = 0.95
        Case 3
            discount = 0.92
        Case Else
            discount = 0.9
    End Select
    Text2 = Int(discount * p * Text1)
End Sub
Private Sub Command3_Click()
    Open App.Path & "\out5.txt" For Output As #1
    Print #1, List1.Text, Text1, Text2
    Close #1
End Sub
Private Sub List1_Click()
'需要考生编写的内容
    Text1 = a(List1.ListIndex + 1)
End Sub
← 上一卷下一卷 →