二级VB上机题库33

时长:120分钟 总分:100分

43浏览 0人已完成答题

题型介绍
题型 简答题
数量 10
第65套
一、基本操作题
1.
  
问题详情
2.
  
问题详情
二、简单应用题
3.
   
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
问题详情
4.
   
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
问题详情
三、综合应用题
5.
   
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
问题详情
第66套
一、基本操作题
6.
  
问题详情
7.
  
问题详情
二、简单应用题
8.
   
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
问题详情
9.
   
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
问题详情
三、综合应用题
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
问题详情