选择题
1. Visual Basic中的窗体文件的扩展名是
A、.reg
B、.frm C、.bas D、.vbp
2. Visual Basic中的模块文件的扩展名是
A、.reg
B、.frm C、.bas D、.vbp
3. Visual Basic中的工程文件的扩展名是
A、.reg
B、.frm C、.bas D、.vbp
4. 一个对象可以执行的动作和可被对象识别的动作分别称为
A、事件、方法 B、方法、事件 C、属性、方法 D、过程、事件
5要使窗体在运行时不可改变窗体的大小和没有最大化和最小化按钮,要对下列 属性进行设置。 A.MaxButton
D.BorderStyle
B.Width
C.MinButton
6 在用菜单编辑器设计菜单时,必需输入的项有____。 A.快捷键
B.索引
C.标题
D.名称
8 文件号最大可取的值为
A 255 B511 C512 D256
9 以下能判断是否到达文件尾的函数是____ A BOF B LOC C LOF D EOF 10 Visual basic 常见的颜色设置中,表示红色的是 A vbblue B vbred C vbblack D vbcyan
11当使用line方法画直线后,当前坐标在
A (0,0) B 直线起点 C 直线终点 D容器的中心 12语句circle(500,500),300,8,-6,-3将绘制 A圆 B 椭圆 C 圆弧 D扇形 13坐标度量单位可以通过 来改变
A Drawstyle B Drawwidth C Scale D Scalemode 14对象的边框类型由 设置
A Drawstyle B Drawwidth C Borderstyle D Scalemode 15以下的属性和方法中 可重新定义坐标系
A Drawstyle B Drawwidth C Scale D Scalemode 16执行语句line(1200,1200)——step(1000,500),B后,CurrentX= A 2200 B 1200 C 1000 D 1700 17 在下列通用对话框的叙述中,错误的是 A Commondialogl.showfont显示字体对话框
B 在打开或另存为对话框中,用户选择的文件名可以通过Filetitle属性返回
C在打开或另存为对话框中,用户选择的文件名及其路径可以经Filetitle属性返回
D 通过对话框可以用来制作和显示帮助对话框
填空题
1如果要将某个菜单项设计为分隔线,则该菜单的标题应设置为 -(减号) 。
2欲定义一个定长为10的字符串变量Mystr,可写成:Dim Mystr As String*10
3把条件为1? x ? 5 写成VB表达式为:1<=x And x<=5
4 在菜单编辑器中 菜单项前面4个小点的含义是该菜单项为下一级的菜单项
程序运行题1.
Private Sub Form_Click() Dim y As Integer Do
y = InputBox(\
If (y Mod 10) + Int(y / 10) = 10 Then Print y Loop Until y = 0 End Sub
运行时,单击窗体后依次输入10、37、50、55、56、64、20、28、19、-19、0,写出运行结果。
37 55 64 28 19
程序运行题2.
Private Sub Command1_Click() Dim i As Integer, n As Integer Dim x As String, c As String x = InputBox(\
n = Len(x)
If n Mod 2 = 1 Then c = Mid(x, n \\ 2 + 1, 1) For i = 1 To Len(x) \\ 2
c = Mid(x, Len(x) + 1 - i, 1) + c + Mid(x, i, 1) Next i x = c Print x End Sub
运行时,第一次单击Command1后输入“abc”,写出运行结果。第二次单击Command1后输入“abcd”,写出运行结果。
cba cdab 程序运行题3
Private Sub Command1_Click() Dim m As Integer, n As Integer Dim a(3, 3) As Integer For m = 1 To 3 For n = 1 To 3
a(m, n) = (m - 1) * 3 + n Next n Next m
For m = 2 To 3 For n = 1 To 2 Print a(n, m); Next n Next m End Sub
写出程序运行后,单击命令按钮,窗体上显示的结果。2 5 3 6
程序运行题 4
Private sub form_click() Dim a(2,3) as integer For i =1 to 2 For j=1to 3 a(i,j)=2*i-j next j,i for h=1to 3 for k=1to 2 form1.print a(k,h), next k print next h end sub
VB程序设计期末试卷及答案



