(21) 在visual basic种,要使标签的标题栏靠右显示,则将其alignment属性设置为
a) 0
b) 2
c) 1
d) 3
正确答案: c
(22) 属性bordercolor的作用是
a) 设置直线颜色和形状边界颜色
b) 设置直线或形状背景颜色
c) 设置直线或形状边界线的线型
d) 设置形状的内部颜色
正确答案: a
(23) 下面哪个程序段能够正确实现如果a<b,则a=1,否则a=-1?
a) if a<b then a=1
a=-1
print a
b) if a<b then a=1 :print a
a=-1:print a
c) if a<b then
a=1:print a
else
a=-1:
end if
d) if a<b then a=1
a=-1
print a
print a
考生答案: 正确答案: c
(24) 下列程序段的执行结果为
a=2
b=0
select case a
case 1
select case b
case 0
print "**0**"
case 1
print "**1**"
end select
case 2
print "**2**"
end select
a) **0**
b) **1**
c) **2**
d) 0
正确答案: c
(25) 在窗体上画一个名称为drive1的驱动器列表框,一个名称为dir1的目录列表框,一个名称为file1的文件列表框,两个名称分虽为label1、label2,标题分别为空白和"共有文件"的标签。编写程序,使得驱动器列表框与目录列表框、目录列表框与文件列表框同步变化,并且在标签label1中显示当前文件夹中文件的数量。如图所示。
能够正确实现上述功能的程序是
a) private sub dir1_change()
file1.path=dir1.path
end sub
private sub dive1_change()
dir1.path=drive1.drive
label1.caption=file1.listcount
end sub
b) private sub dir1_change()
file.path=dir1.path
end sub
private sub dive1_change()
dir1.path=drive1.drive
label1.caption=file1.list
end sub
c) private sub dir1_change()
file1.path = dir1.path
label1.caption = file1.listcount
end sub
private sub drive1_change()
dir1.path = drive1.drive
label1.caption = file1.listcount
end sub
(d) private sub dir1_change()
file1.path=dir1.path
label1.caption=file1.listcount
end sub
private sub dive1_change()
dir1.path=drive1.drive
label1.caption= file1.list
end sub
正确答案: c
(26) 设有声明语句
option base 1
dim b(-1 to 10, 2 to 9, 20) as integer
则数组b中全部元素的个数
a) 2310
b) 1920
c) 1500
d) 1658
正确答案: b
(27) 单击命令按钮,下列事件过程的执行结果为
private sub command1_click()
dim x as integer, y as integer
x=40: y=72
call ptop(x, y)
print x; y
end sub
public sub ptop(byval n as integer, byval m as integer)
n=n \ 10+2
m=m \ 10+2
end sub
a) 0 8
b) 40 72
c) 4 50
d) 78 50
正确答案: b
(28) 下列程序的执行结果为
private sub command1_click()
dim p as integer, q as integer
p=12: q=20
call value(p, q)
print p; q
end sub
private sub value(byval m as integer, byval n as integer)
m=m * 2: n=n - 5
print m; n
end sub
a)20 12
20 15
b)12 20
12 25
c)24 15
12 20
d)24 12
12 15
考生答案: 正确答案: c
(29) 在窗体上画一个命令按钮,然后编写如下程序:
private sub command3_click()
cop 2
cop 3
cop 4
end sub
sub cop (a as integer)
static x as integer
x=x + a
print x;
end sub
程序运行后,单击命令按钮,输出结果为
a) 2 3 4
b) 2 5 9
c) 3 5 4
d) 2 4 3
正确答案: b
(30) 有如下事件过程,单击命令按钮扣,输出结果为
private sub command1_click()
dim b%(1 to 4) , j%, t#
for j=1 to 4
b(j) =j
next j
t=tax(b() )
print "t="; t,
end sub
function tax (a() as integer)
dim t#, i%
t=1
for i=2 to ubound(a)
t=t * a(i)
next i
tax=t
end function
a) t=18
b) t=24
c) t=30
d) t=32
正确答案: b