学习网考试学习资料

Gzu521.com

2007年9月计算机二级VB模拟试题(13)及答案(3)

全国计算机等级考试   点击:次   发布时间:2007-9-20   【字体: 】   来源:Gzu521.com
GZU521.COM学习网

(31) 设在窗体上有一个文本框,然后编写如下的事件过程:
private sub text1_keydown(keycode as integer, shift as integer)
   const alt=4
   const key_f2=&h71
   altdown%=(shift and alt) > 0
   f2down%=(keycode=key_f2)
   if altdown% and f2down% then
       text1.text="abl"
   end if
end sub
程序运行后,清除文本框中原有内容,如果按shift+f2键,则在文本框中显示的是
a) alt+f2      
b) abl
c) 随机出几个数     
d) 不发生变化
正确答案:  d

(32) 设已经在菜单编辑器中设计了窗体的快捷菜单,其顶级菜单为bt,取消其"可见"属性,运行时,在以下事件过程中,可以使快捷菜单相应鼠标右键菜单的是
a) private sub form_mousedown(button as integer, shift as integer, _
                            x as single, y as single)
     if button=2 then popupmenu bt, 2
  end sub
b) private sub form_mousedown(button as integer, shift as integer, _
                            x as single, y as single)
    popupmenu bt
  end sub
c) private sub form_mousedown(button as integer, shift as integer, _
                            x as single, y as single)
     popupmenu bt,0
  end sub
d) private sub form_mousedown(button as integer, shift as integer, _
                            x as single, y as single)
     if (button=vbleftbutton) or (button=vbrightbutton) then popupmenu bt
  end sub
正确答案:  a

(33) 在窗体上画一个通用对话框,其name属性为cont,再画一个命令按钮,name属性为command1,然后编写如下事件过程:
private sub command1_click()
   cont.filename=""
   cont.flags=vbofnfilemustexist
   cont.filter="all files|*.*"
   cont.filterindex=3
   cont.dialogtitle="open file"
   co nt.action=1
   if cont.filename="" then
      msgbox "no file selected"
   else
      open cont.filename for input as #1
      do while not eof(1)
         input #1, b$
         print b$
      loop
   end if
end sub
以下各选项,对上述事件过程描述错误的是
a) 该事件过程用来建立一个open对话框,可以在这个对话框中选择要打开的文件
b) 选择后单击"打开"按钮,所选择的文件名即作为对话框的filename属性值
c) open对话框不仅仅用来选择一个文件,还可以打开、显示文件
d) 过程中的"cont.action=1"用来建立open对话框,它与cont.showopen等价
正确答案:  c

(34) 已知使用show方法的格式为:[窗体名称].show [模式],如果要使窗体是"模态型"窗体,则"模式"值为
a) true       
b) 0
c) 1        
d) false
正确答案:  c

(35) 下面叙述不正确的是
a) 对顺序文件中的数据操作只能按一定的顺序操作
b) 顺序文件结构简单
c) 能同时对顺序文件进行读写操作
d) 顺序文件中只能知道第一个记录的位置
正确答案:  c

二 、填空题 
(1) 当线性表采用顺序存储结构实现存储时,其主要特点是 【1】 。
正确答案:  1.(逻辑结构中相邻的结点在存储结构中仍相邻)

(2) 软件工程的出现是由于 【2】 。
正确答案:  1.(软件危机的出现)

(3) 单元测试又称模块测试,一般采用 【3】 测试。
正确答案:  1.(白盒法)

(4) 数据库恢复是将数据库从 【4】 状态恢复到某一已知的正确状态。
正确答案:  1.(错误)

(5) 数据的基本单位是 【5】 。
正确答案:  1.(数据元素)

(6) 下列语句的输出结果是 【6】 。
print format$(6658.6, "000,000.00")
正确答案:  1.(006,658.60)

(7) 如果在d盘当前文件夹下已经存在名为pic.dat的顺序文件,那么执行语句open "d:\pic.dat" for append as #1之后将 【7】 。
正确答案:  1.(在文件尾添加新内容)

(8) 在有下面一个程序段从文本框中输入数据,如果该数据满足条件,除以6余2,除以5余3,则输出,否则,将焦点定位在文本框中,并清除文本框的内容。
private sub command1_click()
   num=val(text1.text)
   if 【8】 then
      print num
   else
       text1.text=""
        【9】
   end if
end sub
正确答案:  1.(num mod 6 = 2 and num mod 5 = 3) 2.(text1.setfocus)

(9) 下面的程序的作用是利用随机函数产生10个100~300(不包含300) 之间的随机整数,打印其中7的倍数的数,并求它们的总和,请填空。
sub tof()
   randomize
   dim s as double
   dim a(10) as integer
   for i=0 to 9
       【10】
   next
   for i=0 to 9
        if 【11】 then
           print a(i)
           s=s + a(i)
         【12】
   next i
   print
   print "s="; s
end sub
正确答案:  1.(a(i) = int(rnd * 200 + 100)) 2.(a(i) mod 7 = 0) 3.(end if)

(10) 下面的程序是计算给定函数的值,自变量x,y的值用inputbox函数输入,函数如下:
f(x,y) =
程序不完整,请填空,将程序的补充完整。
option explicit
dim x as single
dim y as single
dim z as single
private sub command1_click()
   x=val(inputbox("x=") )
   y=val(inputbox("y=") )
end sub
private sub command2_click()
   if 【13】 then
      z=x ^ 2 + y ^ 2
   elseif 【14】 then
      z=x ^ 2 - 2 * y ^ 2
    【15】
      z=y ^ 2 - 3 * x ^ 2
   end if
   form1.print "当x,y的值为:"; x, y
   form1.print "f(x,y) 的值为:"; z
end sub
正确答案:  1.(x > 0 and y > 0) 2.(x < 0 and y > 0) 3.(else)

上一页 本文共3页:第 [1] [2] [3]

责任编辑:gzu521

IT认证分类
计算机软件水平考试
全国计算机等级考试
思科认证
微软认证
ORACLE/CIW认证
Linux认证
JAVA认证
其它认证
分类推荐信息
更多...
大类最新文章
更多...