计算机类二级VB

二级VB上机题库33

10 题含答案VB
共 10 题返回本类
2材料分析题2 / 10
  
查看答案
Private Sub Command1_Click()
  Image1.Left = Image1.Left + 10
'  或  Image1.Left = 10 + Image1.Left
'  或  Image1.Move Image1.Left + 10
'  或  Image1.Move 10 + Image1.Left
End Sub
Private Sub Command2_Click()
  Image1.Left = 360
End Sub
3材料分析题3 / 10
   
Dim flag As Integer
Private Sub Cmd_Click(Index As Integer)
'  If Index =  ?  Then
      End
  Else
      '考生文件夹下的图片文件
      Image1.Picture = LoadPicture("yellow.ico")
      flag = Index
'      Timer1.Enabled =  ?
  End If
End Sub
Private Sub Timer1_Timer()
'    Select Case  ?
      Case 0
          Image1.Picture = LoadPicture("green.ico")
          Timer1.Enabled = False
      Case 1
          Image1.Picture = LoadPicture("red.ico")
          Timer1.Enabled = False
  End Select
End Sub
查看答案
  If Index = 2 Then
      Timer1.Enabled = True
    Select Case flag
4材料分析题4 / 10
   
Private Sub Command1_Click()
  Open App.Path & "\in4.dat" For Input As #1
  s = Input(LOF(1), #1)
  Close #1
  Text1.Text = s
End Sub
Private Sub Command2_Click()
  Dim m As Integer
'  If Len(s) =  ?  Then
      MsgBox "请先使用“读数据”功能!"
  Else
'      If Text1.?  = 0 Then
          MsgBox "请先选中文本!"
      Else
          t = ""
          For i = 1 To Text1.SelLength
            c = Mid(Text1.SelText, i, 1)
            If c <> " " Then
              t = t + c
            Else
'                x =  ?
                If InStr(x, "o") <> 0 And InStr(x, "n") <> 0 Then
                  m = m + 1
                End If
                t = ""
            End If
          Next i
'          ?  = Str(m)
      End If
  End If
End Sub
查看答案
  If Len(s) = 0 Then
      If Text1.SelLength = 0 Then
                x = LCase(t)
          Text2.Text = Str(m)
5材料分析题5 / 10
   
Option Base 1
Dim a(100) As Integer, num As Integer
Private Sub Command1_Click()
    Dim k As Integer
    Open App.Path & "\in5.dat" For Input As #1
    For k = 1 To 100
        Input #1, a(k)
        Text1 = Text1 + Str(a(k)) + Space(2)
    Next k
    Close #1
End Sub
Private Sub Command2_Click()
  Dim b(100) As Integer
  num = 0
  If Len(Text1.Text) = 0 Then
      MsgBox "请先执行“读数据”功能!"
  Else
      '考生编写(功能:生成存放素数的数组 b )
      '注意:请务必将数组 b 的元素个数存入变量 num 中
==================
???
================== 
      '以下程序段将 b 数组的内容显示在Text2中
      For i = 1 To num
          Text2.Text = Text2.Text + Str(b(i)) + Space(2)
      Next i
  End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
    Open App.Path & "\out5.dat" For Output As #1
    Print #1, Text2.Text
    Close #1
End Sub
查看答案
      For i = 1 To 100
        flag = 0
        For j = 2 To a(i) - 1
            If a(i) / j = Fix(a(i) / j) Then
              flag = 1
              Exit For
            End If
        Next
        If flag = 0 Then
            num = num + 1
            b(num) = a(i)
        End If
      Next
7材料分析题7 / 10
  
查看答案
Private Sub List1_Click()
    HS.Width = List1.Text
'或    HS.Width = Val(List1.Text)
'或    HS.Width = Val(List1)
'或    HS.Width = List1
End Sub
8材料分析题8 / 10
   
Private Sub Option1_Click(Index As Integer)
    Dim n As Integer
    n = Val(Text1.Text)
'    Select Case ?
        Case 0
'            Text2.Text = f1(?)
        Case 1
'            Text2.Text = f1(?)
    End Select
End Sub
Public Function f1(n As Integer) As Integer
    Dim x As Long
    x = 1
'    For i = 1 To ?
      x = x * i
    Next
'    ? = x
End Function
Private Sub Text2_Change()
End Sub
查看答案
    Select Case Index
            Text2.Text = f1(n)
            Text2.Text = f1(n + 2)
    For i = 1 To n
    f1 = x
9材料分析题9 / 10
   
Private Sub Command1_Click()
    s = Text1.Text
    s1 = RTrim(Text2.Text)
    Do
'      p = ?(s, s1)
        If p <> 0 Then n = n + 1
'      s = ?(s, p + 1)
'  Loop While p ? 0
'  Label3.Caption = ?
End Sub
Private Sub Form_Load()
    Open App.Path & "\in4.txt" For Input As #1
    Line Input #1, s
'  Text1.Text = ?
    Close #1
End Sub
查看答案
        p = InStr(s, s1)
        s = Mid(s, p + 1)
    Loop While p <> 0
    Label3.Caption = n
    Text1.Text = s
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% = 18000
    Do
        a% = a% - 1
    Loop Until isprime(a%)
    Text1.Text = a%
End Sub
Private Sub C2_Click()
    Open "out5.txt" For Output As #1
    Print #1, Text1.Text
    Close #1
End Sub
← 上一卷下一卷 →