二级VB考试经验分享试题及答案
姓名:____________________
一、单项选择题(每题2分,共10题)
1.以下哪个选项不是VisualBasic中的基本数据类型?
A.Integer
B.String
C.Boolean
D.Array
2.在VisualBasic中,声明一个整型变量的正确语法是:
A.DimaAsInteger
B.DimaInt
C.Integera
D.a=10
3.以下哪个方法可以用来检查一个字符串是否以特定子串开始?
A.InStr
B.Left
C.Mid
D.Right
4.在VisualBasic中,如何定义一个二维数组?
A.Dimarr(1To2,1To2)AsInteger
B.Dimarr[1,2]AsInteger
C.Dimarr(1,2)AsInteger
D.Dimarr{1,2}AsInteger
5.以下哪个选项是VisualBasic中的条件运算符?
A.||
B.
C.?
D.!
6.在VisualBasic中,如何声明一个函数,该函数返回两个整数的和?
A.FunctionAdd(aAsInteger,bAsInteger)AsInteger
B.FunctionAdd(a,bAsInteger)AsInteger
C.FunctionAdd(a,b)AsInteger
D.FunctionAdd(aAsInteger,b)AsInteger
7.以下哪个方法可以用来删除字符串中的所有空白字符?
A.Trim
B.LTrim
C.RTrim
D.Replace
8.在VisualBasic中,如何遍历一个数组的所有元素?
A.ForEachelementInarray
B.ForelementAsInteger=0Toarray.Length-1
C.ForEachelementAsIntegerInarray
D.ForelementAsInteger=array.LengthTo0Step-1
9.以下哪个选项是VisualBasic中的逻辑运算符?
A.*
B./
C.^
D.And
10.在VisualBasic中,如何定义一个事件处理程序?
A.PrivateSubEventName()
B.PrivateSubForm.EventName()
C.PublicSubEventName()
D.PublicSubForm.EventName()
二、多项选择题(每题3分,共10题)
1.以下哪些是VisualBasic中用于控制程序流程的结构?
A.If-Then-Else
B.For-Next
C.Do-Loop
D.Switch-Case
2.在VisualBasic中,以下哪些方法可以用来处理文件?
A.Open
B.Write
C.Read
D.Close
3.以下哪些是VisualBasic中的常用控件?
A.TextBox
B.Button
C.Label
D.Image
4.以下哪些是VisualBasic中的错误处理关键字?
A.OnErrorResumeNext
B.OnErrorGoToLabel
C.Try
D.Catch
5.在VisualBasic中,以下哪些属性可以用来设置控件的背景颜色?
A.BackColor
B.ForeColor
C.Color
D.TextColor
6.以下哪些是VisualBasic中的数学函数?
A.Abs
B.Sqr
C.Log
D.Round
7.在VisualBasic中,以下哪些是用于字符串操作的方法?
A.Concatenate
B.Split
C.Trim
D.Replace
8.以下哪些是VisualBasic中的数组操作方法?
A.UBound
B.LBound
C.ReDim
D.Erase
9.在VisualBasic中,以下哪些是用于创建图形和图像的方法?
A.Line
B.Circle
C.PSet
D.PaintPicture
10.以下哪些是VisualBasic中的文件操作函数?
A.FileLen
B.FileGet
C.FilePut
D.FileCopy
三、判断题(每题2分,共10题)
1.在VisualBasic中,所有的变