VBA练习四答案
一、选择题
1、下列逻辑表达式中,能正确表示条件“X和Y至少有一个是偶数”的是( A )。 A.X Mod 2=0 OR Y Mod 2=0 B.X Mod 2=1 OR Y Mod 2=1 C.X Mod 2=0 And Y Mod 2=0 D.X Mod 2=1 And Y Mod 2=1 2、定义了二维数组 A(3 to 5,6),则该数组的元素个数为( C )。 A.18 B.27 C.21 D.30 3、有如下程序段: Dim str As String*10 Dim i
Str1=\ i=12
len1=Len(i )
str2=Right(str1,4)
执行后,len1和str2的返回值分别是( C )。
A.12,abcd B.10,bcde C.2,defg D.0,cdef 4、以下可以得到“2+6=8”的结果的VBA表达式是( A )。 A.“2+6” &”=” & 2+6 B.” 2+6”+”=”+2+6 C.2+6& “=” & 2+6 D.2+6 +”=” + 2+6
5、窗体上添加3个命令按钮,分别命名为command1、command2和command3,编写command1的单击事件过程,完成的功能为:当单击按钮command1时,按钮comand2可用,按钮command3不可见,以下正确的是( C )。
A. B.
Private sub command1_click( ) Private sub command1_click( )
Command2.visible=true Command2.visible=true
Command3.visible=false Command3.visible=false
End sub End sub
C.
Private sub command1_click( )
D.
Command2.Enabled=true
Private sub command1_click( )
Command3. visible =false
Command2.visible=true
End sub
Command3.enabled=false
End sub 6、用于获得字符串str从第二个字符开始的3个字符的函数是( A )。 A .mid(str,2,3) B .middle(str,2,2) C .right(str,2,3) D .left(str,2,3)
7、VBA代码调试过程中,能够显示出所有在当前过程中变量声明及变量值信息的是( C )。 A.本地窗口 B.立即窗口 C.监视窗口 D.快速监视窗口 8、在VBA中有返回值的处理过程是( C )
A.声明过程 B.Sub过程 C.Function 过程 D.控制过程 9、InputBox函数返回值的类型为( B )。 A)数值 B)字符串
C)变体 D)数值或字符串(视输入的数据而定) 10、执行下面的语句后,所弹出的信息框外观样式为( C )。 MsgBox \
11、在MsgBox(prompt,buttons,title,helpfile,context)函数调用形式中必须提供的参数是( A )。 A)prompt B)buttons C)title D)context
12、在VBA 语言中,以下关于运算优先级比较,叙述正确的是( B )。 A.算术运算符 > 关系运算符 >连接运算符 > 逻辑运算符 B.算术运算符 > 连接运算符 >关系运算符 > 逻辑运算符 C.关系运算符 >算术运算符 >连接运算符 > 逻辑运算符 D.关系运算符 >连接运算符 >算术运算符 > 逻辑运算符
13、一般用于存放其他ACCESS数据库对象使用的公共过程称为( B )。 A.类模块 B.标准模块 C.宏模块 D.窗体模块
14、布尔型数据转换为其他类型数据时,false转换为( A )。 A.0 B.1 C.-1 D.2
15、用于获得字符串str从第1个字符开始的4个字符的函数是( D )。 A .mid(str,1,3) B .middle(str,1,4) C .right(str,1,3) D .left(str,4) 16、程序段:
Dim I As Integer I=Int(-3.25)
I的返回值是( B )。
A)-3 B)-4 C)3 D)3.25 17、程序段:
Dim M As Single Dim N As Single
Dim P As Single M=Abs(-7) N=Int(-2.4) P=M+N
P的返回值是( D )。
A)9 B)-9 C)5 D)4 18、程序段: str1=\ str2=\
s=Instr(str1, str2)
t=Instr(3,\ s的返回值是( B )。
A)3 B)4 C)5 D)6 19、程序段:
str1=\
str2=\计算机等级考试\ str3=Right(str1,3)
str3的返回值是( C )。
A)hel B)loworld C)rld D)hellowo 20、程序段: D=#2004-8-1# T=#12:08:20# MM=Month(D) SS=Second(T)
MM的返回值是( B )。
A)2004 B)8 C)1 D)2004-8-1
二、填空题:
1、VBA语言中,函数InputBox的功能是( 等待用户输入并返回输入内容 )。
2、在VBA中,布尔型数据转换为其他类型数据时,false转换为:( 0 ),true转换为:( -1 )。3、以下程序段运行后,消息框的输出结果为( 0 )。 a=abs (3) b=abs (-2) c=a>b msgbox (c+1)
4、用逻辑表达式表达出“km和Lm都是偶数”,则表达式为:( km Mod 2=0 and Lm Mod 2=0 )。5、连接式2*8 & ”=” & ” 4*4”的运算结果为:( 16= 4*4 )。 6、写出下列表达式的值:
(5+8*3)\\3 ( 9 ) 3^2+8 ( 17 )
?#11/22/99#- ( 1999-11-22 )
\ 123 & \ ZYX123ABC )
7、VBE的代码窗口顶部包含两个组合框,左侧为对象列表,右侧为( 过程列表 )。 8、VBA语言中,( msgbox )函数的功能是显示消息信息。
9.要实现以下图示效果的消息框提示,VBA代码语句为(msgbox(\数据处理结束!\。
三、应用题
1、编写一个求解圆面积的函数过程Area() Function area(r as single) as single
Area=3.14*r^2 End function
相关推荐: