[计算机类试卷]VB笔试章节练习试卷21及答案与解析.doc

上传人:sofeeling205 文档编号:494303 上传时间:2018-11-28 格式:DOC 页数:8 大小:36KB
下载 相关 举报
[计算机类试卷]VB笔试章节练习试卷21及答案与解析.doc_第1页
第1页 / 共8页
[计算机类试卷]VB笔试章节练习试卷21及答案与解析.doc_第2页
第2页 / 共8页
[计算机类试卷]VB笔试章节练习试卷21及答案与解析.doc_第3页
第3页 / 共8页
[计算机类试卷]VB笔试章节练习试卷21及答案与解析.doc_第4页
第4页 / 共8页
[计算机类试卷]VB笔试章节练习试卷21及答案与解析.doc_第5页
第5页 / 共8页
点击查看更多>>
资源描述

1、VB笔试章节练习试卷 21及答案与解析 1 单击一次命令按钮之后,下列程序代码的执行结果为 _。 Private Sub Command1_ Click() a = fun(4) + fun(5) Print a; End Sub Public Function fun (n As Integer) Static Num For i = 1 To n Num = Num + i Next i fun = Num End Function ( A) 15 ( B) 20 ( C) 35 ( D) 40 2 下面过程定义语句可以使过程调用后不影响主调过程中的实际参数的是 _。 ( A) Sub C

2、om (By Val a, By ValB) ( B) Sub Com (a, By ValB) ( C) Sub Com (a, B) ( D) Sub Com (By Val a, B) 3 单击一次窗体之后,下列程序代码的执行结果为 _。 Private Sub Command1_ Click() Dim x As Integer, y As Integer, z As Integer x = 1: y = 2: z = 3 Call fun1 (x, y, z) Print x; y; z Call fun2(x, y, z) Print x; y; z End Sub Private

3、 Sub fun1(x As Integer, y As Integer, z As Integer) x = 10 * z y=z*z+ x z=x+ y+ z End Sub Private Sub fun2 (ByVal x As Integer, ByVal y As Integer, ByVal z As Integer) x=10*z y=z*z+ x z=x+ y +z End Sub ( A) 1 2 3 30 39 72 ( B) 1 2 3 1 2 3 ( C) 30 39 72 1 2 3 ( D) 30 39 72 30 39 72 4 单击一次窗体之后,下列程序代码的

4、执行结果为 _。 Private Sub Command1_ Click() Dim a As Integer, b As Integer, c As Integer a = 1: b = 2: c = 4 Print Value(a, b,C)End Sub Function Num(x As Integer, y As Integer, z As Integer) Num = x * x + y * y + z * z End Function Function Value(x As Integer, y As Integer, z As Integer) Value = Num(x, y

5、, z) + 2 * x End Function ( A) 21 ( B) 23 ( C) 19 ( D) 35 5 单击一次命令按钮之后,在对话框中输入 12, 2, 34, 23,窗体中的输出结果为_。 Private Sub Command1_ Click () Dim a(4) As Integer For i = 1 To 4 a (i) = Val (InputBox (“请输入元素 ”) Next i plus a(1), a(2), a(3) End Sub Sub plus(first As Integer, second As Integer, third As Inte

6、ger, Optional forth) n = first + second + third If Not IsMissing (forth) Then n = n + forth End If Print n End Sub ( A) 14 ( B) 71 ( C) 48 ( D) 37 6 单击一次命令按钮之后,在对话框中输入 10, 20, 30, 40,窗体中的输出结果为 _。 Private Sub Command1_ Click() Dim a(4) As Integer For i = 1 To 4 a(i) = InputBox (“请输入 :”) Next i Call s

7、ubper (A For i = 1 To 4 Print a(i) Next i End Sub Sub subper (b () As Integer) For i = 1 To 4 b(i) = 2 * i Next i End Sub ( A) 10 20 30 40 ( B) 1 2 3 4 ( C) 2 4 6 8 ( D) 5 10 15 20 7 单击一次命令按钮之后,在对话框中输入 12, 21, 30, 3,窗体中的输出结果为_。 Private Sub Command1_ Click() For i = 1 To 4 s = InputBox (“请输入 ”) Call

8、per(i, s) Next i Print s End Sub Sub per(a, ByValB)b = 1 For i = 1 To 3 a = a * i Next i End Sub ( A) 12 21 30 3 ( B) 24 42 60 6 ( C) 3 30 21 12 ( D)只能输入一个数 8 单击一次命令按钮之后,窗体中的输出结果为 _。 Private Sub Command1_ Click() Dim a As Integer, b As Integer For i = 1 To 6 a=i*i+i Next i Call writein(a,B)Print a,

9、b End Sub Sub writein(a, ByValB)b = 1 For i = 1 To 6 a=b* 4 b = b + 1 Next i End Sub ( A) 24 6 ( B) 24 0 ( C) 12 6 ( D) 12 0 9 下列 Sub 过程中描述错误的是 _。 ( A) Sub 过程只能在窗体模块中定义 ( B) Goto 语句不能用于 Sub 过程 ( C) Sub 过程只能在窗体模块中定义 ( D) Sub 过程中不能嵌套定义 Sub 过程 10 单击一次命令按钮之后,窗体中的输出结果为 _。 Private Sub Command1_ Click() Di

10、m a As Single Dim b As Single a = 10 b = 20 Call Num(a,B)Print a, b End Sub Sub Num(a,B)t = a a = b / t b = t End Sub ( A) 20 10 ( B) 10 20 ( C) 2 10 ( D) 10 10 11 以下叙述中错误的是 _。 ( A)在程序运行时,通用对话框控件是不可见的 ( B)在同一个程序中,用不同的方法 (如 ShowOpen或 ShowSave 等 )激活同一个通用对话框,可以使该通用对话框具有不同的作用 ( C)调用通用对话框的 ShowOpen 方法,能够

11、直接打开在该通用对话框中指定的文件 ( D)调用对话框的 ShowColor 方法,可以打开颜色对话框 12 在窗体上画一个名为 CommonDialog1的通用对话框,一个名称为 Command1的命令按钮。要求单击命令按钮时,打开一个保存文件的通用对话框窗口。该窗口的标题为 “Save”,默认文件名为 “SaveFile“,在 “文件类型 ”栏中显示 “*.txt”。能够满足上述要求的程序是 _。 ( A) Private Sub Command1_ Click() CommonDialog1. FileName = “SaveFile“ CommonDialog1. Filter = “

12、All Files *.* *.txt *.txt *.doc *.doc“ CommonDialog1. Filterlndex = 2 CommonDialog1. DialogTitle = “Save“ CommonDialog1. Action = 2 End Sub ( B) Private Sub Command1_Click() CommonDialog1. FileName = “SaveFile“ CommonDialog1. Filter = “All Files *.* *.txt *.txt *.doc *.doc“ CommonDialog1. Filterlnde

13、x = 1 CommonDialog1. DialogTitle = “Save“ CommonDialog1. Action = 2 End Sub ( C) Private Sub Command1_ Click() CommonDialog1. FileName = “Save“ CommonDialog1. Filter = “All Files %* *.txt *.txt *.doc *.doc“ CommonDialog1. Filterlndex = 2 CommonDialog1. DialogTitle = “Save“ CommonDialog1. Action = 2

14、End Sub ( D) Private Sub Command1_ Click() CommonDialog1. FileName = “SaveFile“ CommonDialog1. Filter = “All Files *.* *.txt *.txt *.doc *.doc“ CommonDialog1. Filterlndex = 1 CommonDialog1. DialogTitle = “Save“. CommonDialog1. Action = 1 End Sub 13 在窗体上画一个通用对话框,其名称为 CommonDialog1,则下列与CommonDialog1.S

15、howOpen方法等效的语句是 _。 ( A) CommonDialog1.Action= 1 ( B) CommonDialog1.Action=2 ( C) CommonDialog1.Action = 3 ( D) CommonDialog1.Action = 4 14 若界面上没有调试工具栏,可通过选中 “视图 ”菜单中【 】中的 “调试 ”子菜单把它显示出来。 15 要运行 VB的程序,可以按【 】键。 16 【 】的功能是显示当前过程所有局部变量的当前值。 17 【 】的功能是查看指定表达式的值。 18 【 】的功能是用于显示当前过程中的有关信息,当测试一个过程时,可在其中输入代码

16、并立即执行。 19 Visual Basic程序在运行过程中,用户可通过按【 】键进入中断状态。 VB笔试章节练习试卷 21答 案与解析 1 【正确答案】 C 2 【正确答案】 A 3 【正确答案】 D 4 【正确答案】 B 5 【正确答案】 C 6 【正确答案】 C 7 【正确答案】 D 8 【正确答案】 B 9 【正确答案】 A 10 【正确答案】 C 11 【正确答案】 C 12 【正确答案】 A 13 【正确答案】 A 14 【正确答案】 工具栏 15 【正确答案】 F5 16 【正确答案】 本地窗口 17 【正确答案】 监视窗口 18 【正确答案】 立即窗口 19 【正确答案】 Ctrl Break

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 考试资料 > 职业资格

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1