2004年4月全国计算机等级考试二级VB语言笔试全真试题及答案
来源:优易学  2011-11-20 14:59:06   【优易学:中国教育考试门户网】   资料下载   IT书店

eyAscii > 90 Then
   MsgBox "请输入大写字母"
   KeyAscii = 0
   End If
  End Sub
  B) Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
   If KeyCode < 65 Or KeyCode > 90 Then
   MsgBox "请输入大写字母"
   KeyCode = 0
   End If
  End Sub
  C) Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   If Asc(Text1.Text) < 65 Or Asc(Text1.Text) > 90 Then
   MsgBox "请输入大写字母"
   End If
  End Sub
  D) Private Sub Text1_Change()
   If Asc(Text1.Text) > 64 And Asc(Text1.Text) < 91 Then
   MsgBox "请输入大写字母"
   End If
  End Sub
  (23) 假定在窗体(名称为Form1)的代码窗口中定义如下记录类型:
  Private Type animal
   AnimalName As String*20
   AColor As String*10
  End Type
  在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程:
  Private Sub Command1_Click()
   Dim rec As animal
   Open "c:\vbTest.dat" For Random As #1 Len = Len(rec)
   rec.animalName = "Cat"
   rec.aColor = "White"
   Put #1, , rec
   Close #1
  End Sub
  则以下叙述中正确的是
  A) 记录类型animal不能在Form1中定义,必须在标准模块中定义
  B) 如果文件c:\vbTest.dat不存在,则Open命令执行失败
  C) 由于Put命令中没有指明记录号,因此每次都把记录写到文件的末尾
  D) 语句“Put #1, , rec”将animal类型的两个数据元素写到文件中
  (24) 在窗体上画一个名称为Text1的文本框,一个名称为Command1的命令按钮,然后编写如下事件过程和通用过程:
  Private Sub Command1_Click()
   n = Val(Text1.Text)
   If n\2 = n/2 Then
   f = f1(n)
   Else
   f = f2(n)
   End If
   Print f; n
  End Sub
  
  Public Function f1(ByRef x)
   x=x*x
   f1=x+x
  End Function
  
  Public Function f2(ByVal x)
   x=x*x
   f2=x+x+x
  End Function
  程序运行后,在文本框中输入6,然后单击命令按钮,窗体上显示的是
  A) 72 36 B) 108 36 C) 72 6 D) 108 6
  (25) 在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程:
  Private Sub Command1_Click()
   c = 1234
   c1 = Trim(Str(c))
   For i = 1 To 4
   Print 
   Next
  End Sub
  程序运行后,单击命令按钮,要求在窗体上显示如下内容
  1
  12
  123
  1234
  则在下划线处应填入的内容为
  A) Right(c1,i) B) Left(c1,i) C) Mid(c1,i,1) D) Mid(

上一页  [1] [2] [3] [4] [5] [6] 下一页

责任编辑:小草

文章搜索:
 相关文章
热点资讯
资讯快报
热门课程培训