(21) 以下属于visual basic合法的数组元素是
a) x8
b) x[8]
c) s(0)
d) v[8]
正确答案: c
(22) 编写如下两个事件过程:
private sub form_keydown (keycode as integer, shift as integer)
print chr(keycode)
end sub
private sub form_keypress(keyascii as integer)
print chr(keyascii)
end sub
在一般情况下(即不按住shift键和锁定大写键时) 运行程序,如果按"a"键,则程序输出的结果是
a) a
a
b) a
a
c) a
a
d) a
a
正确答案: c
(23) 要使菜单项menuone在程序运行时失效,使用的语句是
a) menuone.visible=true
b) menuone.visible=false
c) menuone.enabled=true
d) menuone.enabled=false
正确答案: d
(24) 在窗体上建立通用对话框需要添加的控件是
a) data控件
b) from控件
c) commondialog控件
d) vbcombobox控件
正确答案: c
(25) 在visual basic中,要将一个窗体加载到内存进行预处理但不显示,应使用的语句是
a) load
b) show
c) hide
d) unload
正确答案: a
(26) 运行下列程序段后,显示的结果为
j1=23
j2=32
if j1<j2 then print j2 else print j1
a) 23
b) 32
c) 55
d) 2332
正确答案: b
(27) 下列语句正确的是
a) if a≠b then print "a不等于b"
b) if a<>b then printf "a不等于b"
c) if a<>b then print "a不等于b"
d) if a≠b print "a不等于b"
正确答案: c
(28) 下面语句正确的是
a) if x<3y and x>y then y=x^3
b) if x<3y and x>y then y=3x
c) if x<3y:x>y then y=x^3
d) if x<3y and x>y then y=x* *3
正确答案: a
(29) 计算z的值,当x大于y时,z=x;否则z=y。下列语句错误的是
a) if x>=y then z=x : z=y
b) if x>=y then z=x else z=y
c) z=y : if x>=y then z=x
d) if x<=y then z=y else z=x
正确答案: a
(30) 下列程序段执行结果为
x=5
y=-6
if not x>0 then x=y-3 else y=x+3
print x-y; y-x
a) -3 3
b) 5 -9
c) 3 -3
d) -6 5
正确答案: a
(31) 不能脱离控件(包括客体) 而独立存在的过程是
a) 事件过程
b) 通用过程
c) sub过程
d) 函数过程
正确答案: a
(32) sub过程与function过程最根本的区别是
a) sub过程可以用call语句直接使用过程名调用,而function过程不可以
b) function过程可以有形参,sub过程不可以
c) sub过程不能返回值,而function过程能返回值
d) 两种过程参数的传递方式不同
正确答案: c
(33) 单击命令按钮时,下列程序的执行结果为
private sub command1_click()
dim x as integer, y as integer
x=12:y=32
call proc(x,y)
print x; y
end sub
public sub proc(n as integer, byval m as integer)
n=n mod 10
m=m mod 10
end sub
a) 1232
b) 232
c) 23
d) 123
正确答案: b
(34) 单击命令按钮时,下列程序的执行结果是
private sub command1_click()
dim a as integer, b as integer, c as integer
a=3
b=4
c=5
print secproc(c, b, a)
end sub
function firproc(x as integer, y as integer, z as integer)
firproc=2x+y+3z
end function
function secproc(x as integer, y as integer, z as integer)
secproc=firproc(z, x, y) +x
end function
a) 20
b) 22
c) 28
d) 30
正确答案: c
(35) 下列程序的执行结果为
private sub command1_click()
dim firstr as string
first="abcdef"
print pat(firstr)
end sub
private function pat(xstr as string) as string
dim tempstr as string, strlen as integer
tempstr=""
strlen=len(xstr)
i=1
do while i<=len(xstr) -3
tempstr=tempstr+mid(xstr, i, 1) +mid(xstr, strlen -i+1, 1)
i=i+1
loop
pat=tempstr
end function
a) abcdef
b) afbecd
c) fedcba
d) defabc
正确答案: b