全国计算机等级考试三级难度|2002年全国计算机等级考试三级笔试样题(Visual Basic

试题集锦 2023-06-14 网络整理 可可

【shitiku.jxxyjl.com--试题集锦】

一、选择题
(1)—(35)题每题2分,共70分。
下列各题a)、b)、c)、d)四个先项中,只有一个选择是正确的,请将正确选项涂写在答题卡相应位置上,答在试卷上不得分。

(1) 下列不能打开属性窗口的操作是   。

a) 执行“视图”菜单中的“属性窗口”命令

b) 按f4键

c) 按ctrl+t

d) 单击工具栏上的“属性窗口”按钮   。

(2) 下列可以打开立即窗口的操作是     。

a) ctrl+d   b) ctrl+e    c) ctrl+f   d) ctrl+g

(3) inputbox函数反回值的类型为   。

a) 数值            b) 字符串

c) 变体            d) 数值或字符串(视输入的数据而定)

(4) 可以同时删除字符串前导和尾部空白的函数是   。

a) ltrim    b) rtrim    c) trim    d) mid

(5) 表达式4+5 6 * 7 / 8 mod 9 的值是

a) 4      b) 5      c) 6      d) 7

(6) 如果在立即窗口中执行以下操作:

a=8  <cr>          (<cr>是回车键,下同)

b=9  <cr>print a>b <cr>

则输出结果是   。

a) -1      b) 0      c) false    d) true

(7) 以下语句的输出结果是     。

print format $(32548.5,“000,000.00”)

a) 32548.5 b) 32,548.5   c) 032,548.50  d) 32,548.50

(8) 执行以下程序段后,变量c$=“visual basic programing”b$=“quick”
c$=b$ & ucase(mid$(a$,7,6)) & right $ (a$,11)
a) visual basic programing
b) quick basic programing
c) quick basic programing
d) quick basic programing

(9)  为了在按下回车键时执行某个命令按钮的事件过程,需要把该命令按钮的一个属性设置为true,这个属性是    。

a) value   b) default   c) cancel   d) enabled

(10)为了把焦点移到某个指定的控件,所使用的方法是

a) setfocus   b) visible   c) refresh   d) getfocus

(11)设a=6,则执行 x=iif(a>5,-1,0)后,x 的值为     。

a) 5   b) 6      c) 0      d) -1

(12)执行下面的程序段后,x 的值为      。

x=5for i=1 to 20 step 2
x=x+i5
next i


a) 21      b) 22     c) 23     d) 24

(13)在窗体上画一个命令按钮,然后编写如下事件过程:

private sub command1_click()for i=1 to 4
x=4
for j =1 to 3
x=3
or k=1 to 2
x=x+6
next k
next j
next i
print x
end sub
程序运行后,单击命令按钮,输出结果是   。

a) 7     b) 15     c) 157     d) 538

(14)在窗体上画一个命令按钮,然后编写如下事件过程:prevate sub command1_click()x=0
do until x=-1
a = inputbox(“请输入a的值”)a = val(a)
b = inputbox(“请输入b的值”)b = val(b)
x = inputbox(“请输入x的值”)x = val(x)
a = a+b+x
loop
print a
end sub
程序运行后,单击命令按钮,依次在输入对话框中输入5、4、3、2、1、-1,则输出结果为      。

a) 2    b) 3     c) 14     d) 15

(15)在窗体(name属性为form1)上画两个文本框(其name属性分别为text1和text2)和一个命令按钮(name 属性为command1),然后编写如下两个事件过程:

private sub command1_click()a=text1.text+text2.text
print a
end sub


private sub formm_load()text1 text=""
text2 text=""
end sub
程序运行后,在第一个文本框(text1)和第二个文本框(text2)中分别输入123和321,然后单击命令按钮,则输出结果为    。

a) 444     b) 321123   c) 123321   d) 132231

(16)阅读下面的程序段:for i=1 to 3for j=1 to i
for k=j to 3
a=a+1
next k
next j
next i
执行上面的三重循环后,a 的值为   。

a) 3    b) 9     c) 14     d) 21

(17)在窗体上画一个文本框(其中name属性为text1),然后编写如下事件过程:private sub form_load()ttext1.text="">
text1.setfocus
for i=1 to 10
sum=sum+i
next i
text1.text=sum
end sub
上述程序的运行结果是   。

a) 在文本框text1中输出55b) 在文本框text1中输出0c) 出错d) 在文本框text1中输出不定值

(18)在窗体上画两个文本框(其name 属性分别为text1和text2)和一个命令按钮(其name属性为command1),然后编写如下事件过程:private sub command1_click()x=0
do while x<50
x=(x+2)*(x+3)
n=n+1
loop
text1.text=str(n)
text2.text=str(x)
end sub
程序运行后,单击命令按钮,在两个文本框中显示的值分别为

a) 1和0    b) 2和72    c) 3和50   d) 4和168

(19)用下面语句定义的数组的元素个数是      。

dim a (- 3 to 5 ) as integer

a) 6    b) 7     c) 8     d) 9

(20)以下程序的输出结果是option base 1private sub command1_click()
dim a(10),p(3) as integer
k=5
for i=1 to 10
a(i)=i
next i
for i=1 to 3
p(i)=a(i*i)
next i
for i=1 to 3
k=k+p(i)*2
next i
print k
end sub
a) 33     b) 28     c) 35     d) 37

(21)在窗体上面画一个命令按钮,然后编写如下事件过程:option base 1private sub commandl_click()
dim a
a = array(1,2,3,4)
j = 1
for i = 4 to step -1
s = s + a(i)*j
j =j*10
next i
print s
end sub
运行上面的程序,单击命令按钮,其输出结果是   。

a) 4321    b) 12     c) 34     d) 1234

(22)在窗体上面一个命令按钮(其name属性为commandl),然后编写如下代码:option base 1private sub commandl_click( )
dim a(4,4)
for i =1 to 4
for j =1 to 4
a(i,j) = (i-1)*3+j
next j
next i
for i =3 to 4
for j =3 to 4
print a(j,i);
next j
print
next i
end sub
程序运行后,单击命令按钮,其输出结果为   。

a) 6 9     b) 7 10    c) 8 11    d) 9

127 10      8 11     9 12     10 13

(23)假定有如下的sub过程:sub s(x as single,y as single)t = xx =t/y
y =t mod y
end sub
在窗体上画一个命令按钮,然后编写如下事件过程:private sub commandl_click ( )dim a as single
dim b as single
a =5
b =4
s a,b
print a,b
end sub
程序运行后,单击命令按钮,输出结果为   。

a) 5 4     b) 1 1     c) 1.25 4   d) 1.25 1

(24)阅读程序:function f(a as integer)b = 0
static c
b = b+1
c = c+1
f = a+b+c
end function
 private sub commandl_click ()dim a as integer
a =2
for i =1 to 3
print f(a)
next i
end sub
运行上面的程序,单击命令按钮,输出结果为   。

a) 4    b) 4     c) 4     d) 4

     4        5       6      7

     4        6       8      9

(25)阅读程序:sub subp(b() as integer)for i =1 to 4
b(i)=2*i
next i
end sub
 private sub commandl_click()dim a(1 to 4)as integer
a (1)=5
a (2)=6
a (3)=7
a (4)=8
subp a ()
for i =1 to 4
print a(i)
next i
end sub
运行上面的程序,单击命令按钮,输出结果为   。

a)2    b)5     c)10    d)出错

                               4     6        12

                               6     7         14

                               8     8       16

(26)下列不能打开菜单编辑器的操作是   。

a)按ctrl+e

b)单击工具栏中的“菜单编辑器”按钮

c)执行“工具”菜单中的“菜单编辑器”命令

d)按shift + alt + m

(27)假定有一个菜单项,名为menuitem,为了在运行时使该菜单项失效(变灰),应使用的语句为   。a) menuitem. enabled=false

b) menuitem. enabled=true

c) menuitem. visible=true

d) menultem. visible=false

(28)在程序运行期间,如果拖动滚动条上的滚动块,则触发的滚动条事件是   。

a) move     b) change   c) scroll   d) getfocus

(29)假定窗体上有一个标签,名为labell,为了使该标签透明并且没有边框,则正确的属性设置为   。

a) label1. backstyle=0 label1.borderstyle=0
b) label1.backstyle=1 label1.borderstyle=1
c) label1.backstyle=true label1.borderstyle=true
d) label1.backstyle=false label1.borderstyle=false

(30)在窗体上画一个列表框和一个文本框,然后编写如下两个事件过程:private sub form_load ()list1.additem"357"
list1.additem"246"
list1.additem"123"
listl.additem"456"
text1.text=""
end sub
 private sub list1_ dblclick ( )a =list1.text
print a+text1.text
end sub
程序运行后,在文本框中输入“789”(见图1),然后双击列表框中的"456",则输出结果为  。a) 1245     b) 456789   c) 789456   d) 0

(31)为了暂时关闭计时器,应把该计时器的某个属性设置为false ,这个属性是  。

a) visible   b) timer    c) enabled   d) interval

(32)为了把一个记录型变量的内容写入文件中指定的位置,所使用的语句的格式为  。

a)get文件号,记录号,变量名

b)get文件号,变量名,记录号

c)put文件号,变量名,记录号

d)put文件号,记录号,变量名

(33)对窗体编写如下事件过程:private sub form _mousedown(button as integer, _shift as integer, x as single y as single)
if button =2 then
print "aaaaa"
end if
end sub
 private sub form _ mouseup(button as integer, _shift as integer, x as single, y as single)
print "bbbbb"
end sub
程序运行后,如果单击鼠标右键,则输出结果为    。

a) aaaaa    b) bbbbb    c) aaaaa    d) bbbbbbbbbb                       aaaaa

(34)为了在运行时能显示窗体左上角的控制框(系统菜单),必须    。

a) 把窗体的contro1box 属性设置为fale,其他属性任意

b) 把窗体的controlbox 属性设置为true,并且把boder style属性设置为1-5

c) 把窗体的controlbox 属性设置为false,同时把boderstyle属性调协为非0值

d) 把窗体的controlbox 属性设置为true,同时把boderstyle属性设置为0值

(35)对窗体编写如下代码:option base 1private sub form_keypress(keyascii as integer)
a = array(237,126,87,48,498)
m1 = a(1)
m2 = 1
if keyascii = 13 then
for i =2 to 5
if a(i)>ml then
m1 =a(j)
m2 =i
end if
next i
end if
print m1
print m2
end sub
程序运行后,按回车键,输出结果为

a) 48    b) 237     c) 498     d) 498

     4         1       5       4

二、填空题(每空2分,共30分)
请将每空的正确答案写在答题卡[1]—[15]序号的横线上,答在试卷上不得分。

(1)设有如下的visual basic表达式:5 * x^2 – 3 * x – 2 * sin(a)/3它相当于代数式【1】 。

(2)执行下面的程序段后,s的值为 【2】 。

s = 5for i = 2.6 to 4.9 step 0.6
s = s+1
next i

(3)表达式fix(-32.68)+int(-23.02)的值为【3】 。

(4)为了在运行时把图形文件picfile. jpg装入图片框picture1,所使用的语句为【4】 。

(5)在窗体上画一个命令按钮,然后编写如下事件过程:

private sub command1_click()a = inputbox("请输入一个整数")

b = inputbox("请输入一个整数")

print a + b

end sub
程序运行后,单击命令按钮,在输入对话框中分别输入321和456,输出结果为 【5】。

(6) 执行下面的程序段后,b的值为【6】。

a=300b=20
a=a+b
b=a-b
a=a-b

(7) 以下程序段的输出结果是【7】 。

num=0while num<=2
num=num+1
print num
wend

(8) 在窗体画一个命令按钮,然后编写如下事件过程:private sub command1_click()dim a(1 to 10)
dim p(1 to 3)
k=5
for i=1 to 10
a(i)=i
next i
for i=1 to 3
p(i)=a(i*i)
next i
for i=1 to 3
k=k+p(i)*2
next i
print k
end sub
程序运行后,单击命令按钮,输出结果是【8】 。

(9) 下面的程序用“冒泡”法将数组a中的10个整数按升序排列,请在【9】、【10】、【11】处将程序补充完整。

option base 1private sub command1_click()
dim a
a=array(678,45,324,528,439,387,87,875,273,823)
for i=【9】for j=【10】if a(i)【11】 a(j) thena1=a(i)
a(i)=a(j)
a(j)=a1
end if
next j
next i
for i=1 to 10
print a(i)
next i
end sub

(10) 在窗体画一个命令按钮,然后编写如下过程:function fun(byval num as long)as longdim k as long
k=1
num=abs(num)
do while num
k=k*(num mod 10)
num=num10
loop
fun=k
end function
 private sub command1_click()dim n as long
dim r as long
n=inputbox("请输入一个数")n=clng(n)
r=fun(n)
print r
end sub
程序运行后,单击命令按钮,在输入对话框中输入234,输出结果为【12】 。

(11) 如果要将某个菜单项设计为分隔线,则该菜单项的标题应设置为【13】。

(12) 假定建立了一个工程,该工程包括两个窗体,其名称(name 属性)分别为form1和form2,启动窗体为form1。在form1画一个命令按钮command1,程序运行后,要求当单击该命令按钮时,form1窗体消失,显示窗体form2,请在【14】和【15】处将程序补充完整。

private sub command1_click()【14】 form1form2. 【15】end sub

本文来源:https://shitiku.jxxyjl.com/shitijijin2/27176.html

Copyright @ 2011- 考试题库网 All Rights Reserved. 版权所有

免责声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。

 站长统计