当前位置:心圆文档网>专题范文 > 公文范文 > 最新中央电大vb综合复习考试资料及答案参考小抄

最新中央电大vb综合复习考试资料及答案参考小抄

时间:2022-03-09 14:17:43 公文范文 来源:网友投稿

中央电大 VB复习资料考试小抄 1.装载窗体是窗体的( C )。

A) 对象 B) 属性 C) 事件 D) 方法 2.设a=“Visual Basic“,下面使b的值为“Basic“的赋值语句正确的是( B )。

A) b=Left(a,8,12) B) b=Mid(a,8,5) C) b=Right(a,5,5) D) b=Left(a,8,5) 3.设X为整型变量,不能正确表达1< X < 5的逻辑表达式是( A )。

A) 1< X <5 B) X=2 or X=3 or X=4 C) 1<X And X <5 D) Not (X<=1) And Not (X>=5) 4.InputBox函数返回值的类型为( B )。

A) 数值型 B) 字符串型 C) 逻辑型 D) 货币型 5.执行语句:Print 4+5\6*8/8 Mod 9 输出的值是()。A) 4 B) 5 C) 6 D) 7 6.下列循环语句能正常结束循环的是( C )。   A)i=5 B) i=1 Do Do i=i+1 i=i+2 Loop Until i< 0 Loop Until i=10 C)i=10 D) i=6 Do Do i=i+1 i=i-2 Loop Until i> 0 Loop Until i=1 7.以下叙述中正确的是 ( A )。

A) 窗体的Name属性指定窗体的名称 ,用来标识一个窗体 B) 窗体的Name属性的值是显示在窗体标题栏中的文本 C) 可以在运行期间改变窗体的Name属性的值 D) 窗体的Name属性值可以为空 8.VB为命令按钮提供的Cancel属性( A )。

A) 用来指定命令按钮是否为窗体的“取消”按钮 B) 用来指定命令按钮的功能是停止一个程序的运行 C) 用来指定命令按钮的功能是关闭一个运行程序 D) 用来指定命令按钮的功能是中断一个程序的运行 9.若使命令按钮失效,要对( A )属性设置为False。

A) Enabled B) Visible C) BackColor D)Caption 10.在窗体中添加两个文本框(其Name属性分别为Text1和Text2)和一个命令按钮(Name属性为Command1),然后编写如下两个事件过程:
Private Sub Command1_Click() a = UCase(Text1.Text) + Left(Text2.Text, 3) Print a End Sub Private Sub Form_Load() Text1.Text = “abcDEF“ Text2.Text = “123456“ End Sub 程序启动后,单击命令按钮,输出结果为( C )A)abcDEF123456 B)abcDEF123 C)ABCDEF123 D)ab123456 11.在运行程序时,要使文本框获得焦点,则需使用( B )方法。

A) Change B) SetFocus C) GotFocus D) Move 12.下列语句中不能把图片框Picture1中的图形清除的是( A )。

A) Picture1.Del B) Picture1. Picture=LoadPicture(““) C) Picture1. Picture= LoadPicture( ) D) Picture1. Picture=Nothing 13. 要删除列表框中的某一个项目,需要使用( D )方法。

A) Clear B) ReMove C) Move D)ReMoveItem 14.在组合框中选择某一项目内容,在程序中可以通过( D )属性获得。

A) List B) ListIndexC) ListCount D) Text 15.若有数组说明语句:Dim a()AS Integer,则a被定义为( B )。

A) 定长数组 B) 可调数组 C) 静态数组 D) 可变类型数组 16.有如下语句:
Type Student Name As String Age As Integer Sex As String End Type Dim Stu As Student With Stu .Name = “李强“ .Age = 21 .Sex = “男“ End With 执行语句Print Stu.Age后在窗体上显示的结果是( B )。A)李强 B)21 C)“男” D)Age 17.要使子过程f1调用后能用形式参数返回两个结果,下面子过程定义正确的是( C )。

A)Sub f1(ByVal n%,ByVal m%) B)Sub f1(n%,ByVal m%) <子过程体> <子过程体> End Sub End Sub C)Sub f1(n%,m%) D)Sub f1(ByVal n%,m%) <子过程体> <子过程体> End Sub End Sub 18.以下叙述中错误的是( D )。

A) 一个工程中可以包含多个窗体文件 B) 在一个窗体文件中用Private定义的子过程或函数过程不能被其他窗体文件调用 C) 在设计VB程序时,窗体模块和标准模块需要分别保存为不同类型的文件 D) 全局变量必须在标准模块中定义 19.从磁盘上打开顺序文件“c:\t1.txt“为读入数据做好准备,如下语句( A )是正确的。

A)
F=“c:\t1.txt“ B)F=“c:\t1.txt“ Open F For Input As #1 Open “F“ For Input As #2 C)Open “c:\t1.txt“ For Output As #1 D)Open c:\t1.txt For Input As #2 20.以下叙述中正确的是( B )。

A) 一个记录中所包含的各个元素的数据类型必须相同 B) 随机文件中每个记录的长度是固定的 C) Open命令的作用是打开一个已经存在的文件 D) 使用Input#语句可以从随机文件中读取数据 1、 在设计应用程序时,可以查看到应用程序工程所有组成部分的窗口是(D)。

A、 窗体设计    B、代码      C、属性    D、工程资源管理器窗口 2、窗体的load事件的触发时机是(B)。

A、用户单击窗体时  B、窗体被加载时   C、窗体显示之后   D、窗体卸载时 3、与传统的程序设计语言相比,Visual Basic 最突出的特点是(C)。

  A、结构化程序设计  B、程序开发环境  C、事件驱动编程机制   D、程序调试技术 4、VB6.0集成开发环境的主窗口中不包括(C)。

A、标题栏    B、菜单栏    C、状态栏    D、工具栏 5、如果对象的名称为Mytext ,而且对象有一个属性Text,那么在代码中引用该属性的正确格式是(B)。

A、 text.Mytext     B、Mytext.Text    C、Mytext.(Text)  D、Mytext*Text 6、下列可以激活属性窗口的操作是(D)。

   A、用鼠标双击窗体的任何部位    B、执行“工程“菜单中的”属性窗口“命令C、按Ctrl+F4      D、按F4 7、假定已在窗体上画了多个控件,并有一个控件是活动的,为了在属性窗口中设置窗体的属性,预先应执行的操作是(A)
   A、单击窗体上没有控件的地方     B、单击任一个控件     C、不执行任何操作  D、双击窗体的标题 8、如果要在文本框键入字符时,只显示某个字符,如果(*),应设置文本框的(B)属性。

   A 、Caption    B、PasswordChar   C、Text    D、Char 9、如果想要在文本框中的内容在运行时不能编辑,需要文本框的(A)属性设置为True. A Locked          B、MultiLine      C、TabStop  DVisible 10 对于定时器(Tiner)控制,设置其定时是否开启的属性是(C)A、Index          B、Tag            C、Enabled  D、Left 11、要在窗口体Fornl 内显示“myfrm”使用的语句是( C)
A、Form.caption=“myfrm”B、Fornl.caption=“myfrm” C、forml.print“myfrm” D、form.print“myfrm” 12、对象的性质和状态特征称为(C)A、事件         B、方法           C、属性       D、类 13、下列正确的赋值语句是(B)
A、x+y=20       B、y=x+20          C、3x=y     D、s= 14、当使用上下文相关的帮助时,选择要帮助的内容,然后按(D)键,就可出现MSDN窗口直接显示所需的帮助信息。

A、Help   B、F10     C、Ese      D、F1 15、将调试通过的工程经“文件”菜单的“生成.exe文件“编绎成名.exe后,将该可执行文件放到其它机器上不能运行的主要原因是(D)。A、运行的机器上无VB系统      B、缺少.frm 窗体文件    C、该执行文件有病毒    D、以上原因都不对 1.按照变量的作用域可将变量划分为( B   )。

A、公有、私有、系统   B、全局变量、模块级变量、过程变量 C、动态、常数、静态    D、Public、Private、Protect 2. 可获得字符的ASCII码的函数是( C )
A、Val  B、Fix  C、Asc    D、Chr 3、要退出Do….Loop循环,可使用的语句的( D )语句。

A、Exit   B、Exit  For   C、End Do   D、Exit Do 4. 把数值型转换为字符串型需要使用的函数是(B  )。A、Val    B、Str   C、Asc    D、Chr 5.关于语句行,下列说法正确的是( B )。

 A.一行只能写一条语句 B.一条语句可以分多行书写 C.每行的首字符必须大写   D.长度不能超过255个字符 6.表达式6+10 Mod 4*2+1的值是( A ).A.9   B.11   C.1  D.3 7.以下可以作为Visual Basic 变量名的是(B).A.SIN      B.CO1    C.COS(X)  D.X(-1) 8.表达式Abs(-5)+Len(“ABCDE”)的值为(C).A.5ABCDE  B.-5ABCDE      C.10     D.0 9.在代码编辑器中,如果一条语句太长,无法在一行内写下(不包括注释),要折行书写,可以在行末使用续行字符(A),表示下一行是当前行的继续.  A.一个空格加一个下划字符(_)   B.一个下划字符(_)
C.直接回车 D.一个空格加一个字符(-)
10.Sub过程与Function过程最根本的区别是(D).  A.Sub过程可以使用Call语句或直接使用过程名调用,而Function过程不可以.  B.Function过程可以有参数,Sub过程不可以. C.两种过程参数的传递方式不同. D.Sub过程的过程名不能返回值,而Function过程能够通过过程名返回值. 11."X是小于80的非负数",用VB表达式表示正确的是(C).   A..0≤X<80     B.0<=X<80 C.0<=x and x<80    D.0<=x Orx<80 12.在设计菜单时,如果要在菜单中加入一个菜单分隔条,则菜单分隔条的标题必须设置为(B ) A. 加号(+)      B.减号(-)     C.星号(*)   D.感叹号(!) 13.如果要在程序中显示一个弹出式菜单,那么要调用Visual Basic中提供的方法是(D).   A.Print         B.Move       C.Refresh   D.PopupMenu 14.下列可以用来存储图像供其他对象使用的控件是(C ). A.ToolBar      B.StatursBar    C.ImageList   D.TreeView 15.当单击工具拦上的按扭时,会触发的事件是(A ). A.ButtonClick    B.Change   C.Load        D.KeyPress 16.要利用公用对话框控件来显示”打开文件”对话框,需要调用控件的(B )方法.   A.ShowPrinter   B.ShowOpen   C.ShowSave    D.ShowColor 17.对于窗体级变量,下列说法中错误的是(C ). A.所在窗体的各子程序都可以访问 B.其他窗体的子程序不能访问 C.所在窗体发子程序不能访问用Private定义的窗体级变量 D.一定要在所在窗体的通用区内定义 18.从一个字符串中的第3个字符开始,获取5个字符,应使用(B) A.Len函数   B.Mid函数   C.Left函数     D.Right函数 19.用下面的语句所定义的数组的元素的个数是(D ). DimA(-3 To 5)As  Integer A.6     B.7   C.8         D.9 20.有如下程序段: Dim strl As String*5 Strl=”Visual Basic” 当该段程序被执行完时,变量strl的值为(B ). A.”Visual”    B.”Visua”   C.”V”   D.”Visual  Basic” 1、Visible Basic根据计算机访问文件的方式将文件分成三类,其中不包括(B)
A.顺序文件   B. Unix文件   C. 二进制文件   D. 随机文件 2、随机文件进行文件读取的单位是(B)
A.字节    B。记录   C。整个文件    D。字符 3、为了使目录路径列表框Dir1的内容符合驱动器列表框Drive1的选择,应当(B)。

A. 在Dir1_Click事件中加入Dir1.Path=Drive1.Drive B. 在Drive1_Click事件中加入Dir1.Path=Drive1.Drive C. 在Dir1_Click事件中加入Drive1.Path= Dir1.Drive D.在Dir1_Click事件中加入Drive1.Path= Dir1.Drive 4、为了使drive1驱动器列表框、dir1目录路径列表框和file1文件列表框能同步协调工作,需要在(B)
A. drive1的Change事件过程中加入drive1.Drive=dir1.Path,在dir1的Change事件过程中加入dir1.Path=file1.Path代码B. drive1的Change事件过程中加入dir1.Path = drive1.Drive,在dir1的Change事件过程中加入file1.Path =dir1.Path代码。

C. dir1的Change事件过程中加入dir1.Path = drive1.Drive,在file1的Click事件过程中加入file1.Path =file1.fileName代码。D.dir1的Change事件过程中加入dir1.Path = drive1.Drive,在file1的Click事件过程中加入file1.Path =dir1.Path代码。

5、下面关于顺序文件的描述正确的是(A)
A. 每条记录的长度必须相同 B. 可通过编程对文件中的某条记录方便地修改 C. 数据只能以ASCII码形式存放在文件中,所以可通过文本编辑软件显示 D.文件的组织结构复杂 6、KILL语句在VB语言中的功能是(C)。

A.清内存    B。清病毒   C。删除磁盘上的文件    D。清屏幕 7、可用来改变坐标度量单位的是(D)
C. Scale方法   D. ScaleMode属性 8、以下的属性和方法中,可重定义坐标系的是(C)   C. Scale  D.  ScaleMode属性 9、当用Line方法画直线后,当前坐标在(C)
A.(0,0)   B.直线起点   C. 直线终点   D. 容器的中心 10、Line (200, 200)-Step( 500, 500)将在窗体(C)画一直线。

A.(200, 200)到(500, 500)  B. (200, 200)到(300, 300) C.(200, 200)到(700, 700)  D. (300, 300)到(500, 500)
11、设置对象的边框类型的属性是(B)。

A. Drawstyle   B. Borderstyle   C. DrawWidth   D. ScaleMode 12、为了清除图片框Picture1中的图形,应采取的正确方法是(B)
A. 选择图片框,然后按Del键 B. 执行语句Picture1.picture=LoadPicture(“”) C. 执行语句Picture1.picture= “” D.选择图片框,在属性窗口中选择Picture属性条,然后按回车键 13、绘制多种形状的图形,需要设置Shape控件的(A)属性。

A.Shape   B.Borderstyle   C. FillStyle  D. Style 14、绘制多种形状的直线,需要设置Line控件的(B)属性。     A.Shape   B.Borderstyle   C. FillStyle  D. Style 15、如果准备读文件,打开顺序文件“text.dat”的正确语句是(C)
A.      open “text.dat” for write As #1 B.      open “text.dat” for Binary  As #1 C.      open “text.dat” for Input  As #1 D.     open “text.dat” for Random  As #1 16、如果准备向随机文件中写入数据,正确的语句是(C)  C. Put #1, rec  D.  Get #1, rec 17、下列“CommandDialog1”控件程序代码,CommandDialog1.Action=1,代表(B)
A.文件另存为   B. 打开文件  C. 色彩   D. 打印 18、FileFilter.Pattern=”*.bat” 程序代码执行后,会显示(A)。A 只包含扩展文件名为”*.bat”的文件    B。

第一个bat文件C. 包含所有的文件      D。

会显示磁盘的路径 19、下列数据对象模型中采用OLE DB访问数据库的是(C)。A. DAO   B. RDO   C. ADO    D. RDO和ADO 20. 设ADOrs为Recordset对象,从“学生基本情况表”中获取所有记录的语句是(B)
A. ADOrs.New “Select * From 学生基本情况表” B. ADOrs.Open “Select * From 学生基本情况表” C. ADOrs.Execute “Select * From 学生基本情况表” D.ADOrs. Select “Select * From 学生基本情况表” 21、VB中将变量xl声明为Excel应用程序对象的方法是(A)
A. Dim xl As Excel.Application  B. Dim xl As Excel.Workbook C.  Dim xl As Excel.Worksheet   D. Dim xl As Excel.Worksheets 1、 WinsockServer.LocalPort=10001语句的含义是(  A )。

 A、设置侦听端口    B、设置计算机IP地址     C、设置中断地址   D、设置通讯协议 2、当Winsock控件处于关闭状态时,其State属性的值是(  B )。A、1       B、0        C、2         D、6 3、相对于UDP协议而言,TCP协议是一种(  A )。

A、面向连接的协议 B、无连接协议  C、计算机间不建立连接  D、适用于传送少量数据 4、VB程序中通常不会产生错误提示的( D  )。A、编译错误   B、实时错误   C、运行时错误   D、逻辑错误 5、VB程序的编译错误一般可通过VB集成环境的何种设置,自动检测(  B )。

A、要求变量声明  B、自动语法检测  C、自动显示快速信息量  D、根本无法自动检测 6、VB程序中设置断点的按键是(  C  )。A、F5键    B、F6键   C、F9键      D、F10键 7、On Error Go To ErrLB语句中,ErrLB的含义是(  A  )。

A、行标识号   B、SUB过程名  C、FUNCTION过程名  D、错误号 8、Err对象中,用来表示错误描述的属性是( B    )。A、ErrNo      B、Description     C、Number       D、Source 1. Visual Basic程序中分隔一行中各语句的字符是( B :)。

2. 下列可作为Visual Basic的变量名的是( )。

A: Filename B: A(A+B)
C: A%D D : Print 3. 要让菜单项无效,应将( )属性值设置为False。

A. Visible B. Enabled C. Moveable D. Checked 4. 以下过程是( )事件。

Prviate Sub Form_Load( ) ……End Sub A: 命令按钮的单击 B: 命令按钮的装载C; 窗体的装载 D: 窗体的单击 5. Vb中描述文件扩展名的是( )属性。

A: Drive B: Pattern C: FileName D: Path 6. 关于Visual Basic中事件的说法中,不正确的为( )。

[ ] A. 事件是由Visual Basic预先定义好的,能够被对象识别的动作 B. DblClick(双击)是Visual Basic中的一种事件 C. 一个对象可以识别一个或多个事件 D.对于一个系统提供的对象可以识别哪些事件,需要程序员自己定义 7. 下列控件中可设置滚动条是( )。

A. 检查框(复选框)
B. 框架 C. 文本框 D. 标签框 8. 在Visual Basic中建立一个空窗体,( )不会是其默认名。

A. Form1 B. Form2 C. Formx D. Form10 9. Const One&=1,则One为( )类型的常数。

A. 整型 B. 字节型 C.长整型 D.单精度型 10. 关于逻辑型数据,下列说法错误的是( )。

A. 逻辑型数据只有两种可能值:True或者FalseB. 当把逻辑值转换为数值时False转为0,True转为1 C. 当把其他类型数据转换为逻辑数据时,非0数转换为True,0转换为False D. 逻辑型数据以2个字节存储 11. 以下( )不是Visual Basic的特点。

A: 结构化程序设计 B: 集成可视化程序开发环境 C: 事件驱动编程机制 D: 可将用户的编程思想自动转换成程序代码 12. 窗体的load事件可以被用来实现的功能为( )。

A: 确定窗体的位置 B: 从内存中清楚一个窗体C: 在程序启动时对属性和变量初始化 D: 重画窗体 13. 单复选框的控件名称为( )。

A. OptionBotton B. CheckBox C. PictureBox D. Image 14. 若要禁止窗体被移动,可设置窗体的( )属性为False。A.Moveable B: Move C: MinButton D: ControlBox 15. 若要设置定时器的定时间隔设为10秒,应将( )属性值设为10000。A. Interval B. Value C. Enabled D. Text 16. 以下( )是文件夹列表框。A. DirListBox B. DriveListBox C. FileListBox D. ComboBox 17. 以下( )可从通用对话框的“字体”对话框中返回用户选择的字体名。A. FileName B. Path C. FontName D. Color 18. 下列哪个操作可以清除文本框对象Text1的内容( )。A. Text1.Text=““ B. Text1.cls C. Text=““ D. cls 19. 要想通过单击Command1弹出Form2窗体,则可在Command1的单击事件中,使用( )命令。

A. Load Form2 B. Form2.Show C. Form2.SetFocus D. Form2.PopupMenu 20. 以下属性中只在运行时起作用的为( )。A. Caption属性 B. Visible属性 C. BorderStyle属性 D. Picture属性 21. 在运行时,若要使文本框获得输入焦点,可调用文本框对象的( )方法来实现。A. Refresh B. GetFocus C. SetFocus D. Tab 22. 在窗体中利用Print方法输出文本信息时,信息的输出位置由( )属性设置。A. Left B. Top C. x,y D. CurrentX,CurrentY 23. 语句:Dim student(10,5 to 100) 定义的是一个( )维数组。A. 2 B.3 C. 5 D.10 24. 默认情况下,语句:Dim student(10 to 11 ,4) 定义的数组有( )个元素。

A. 20 B.22 C. 10 D.11 25. 已知Eng(1)=90,Math(1)=80,Comp(1)=95 Total(1)= Eng(1)+Math(1)+Comp(1),则Total(1)=( )。A. 265 B.90 C. 80 D.95 26. 已知在“通用”代码有以下语句:
Dim A( ) As Integer则,在某一事件代码中使用( )是正确的。

A. ReDim A(30,4) B. ReDim A(4) As C. ReDim A(100) D. ReDim A( ) 27. Int(-23.512)的值为( )。A.-23 B.-24 C. 24 D.23 28. 将ASCII码转换成字符串的函数是( )。A. Chr$ B. Str$ C. Asc D. Val 29. 表达式 Mid(“Beijing2008“,4,4)的值是( )。A. Beij B. jing C. inj2 D. 2008 30. A$=“+3.14+2“,则Val(A$)的值为( )。A. +3.14+2 B. +5.14 C. 3.14 D. 5.14 1.把数学式子:写成VB的数值表达式( Sqr(1+3.14159/2*Sin(25*3.14159/180)) )。

2.设A=5,B=6,C=7,D=8,表达式3>2*B OR A=C AND B<>C OR C>D的值是( True )。

3.若Case子句中的表达式表列具有形式:<表达式1> To <表达式2>,则它的含义是:当测试表达式的值等于( 指定范围内的值 )时,执行该Case子句相应的语句块。

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

x=0 For i=1 To 8 Step 3 x=x+i Next i 5.在图片框上放置的控件称为图片框的( 子 )对象,而窗体是图片框的( 父 )对象。

6.将命令按钮Command1的Caption属性值赋给文本框Text1的Text属性使用的语句为( Text1.Text=Command1.Caption) 7.复选框的Value属性为( 1 )时,表示复选框被选中。

8. 使用滚动条可以获取某一范围内的数值输入。为使垂直滚动条的Value属性值从下往上递增变化,应设置滚动条Min属性值大于( Max )属性值。

9.语句:Dim A(-3 to 4) as Integer定义的一维数组A的元素个数是( 8 )。

10.给定如下子过程:
Function fun(ByVal num As Long) As Long Dim k As Long,i As Integer k=1 For i=1 To num k=k*i Next i End Function 执行语句Print fun(5) 后在窗体上显示的结果为( 0 )。

1、 当进入VB集成开发环境后,发现没有显示“工具箱”窗口。应选择 视图 菜单的 工具箱 选项,使“工具箱”窗口显示。

2、在VB中,事件过程名由 对象名 和  事件名  构成。

3、 工程文件的扩展名是  vbp ,窗体文件扩展名是  frm  。

4、对象时代码和数据的集合,例如,Visual Basic 中的  窗体 、  按钮 、文本框   等都是对象。

5、对象的方法用于  实施某种操作功能  。当方法不需要任何参数并且也没有返回值,调用对象的方法的格式为 对象名.方法名   。例如对窗体Forml 使用Show 方法,应写成  form1.show   。

6、要使文本框显示滚动条,需要将其 ScrollBars  属性设置为  3  。

7、欲设置定时的时间间隔为4秒,则属性Interval 的值为  4000 。

8、要使标签框的大小随Caption属性做自动调整,应将 AutoSize  属性设置为  True  。

9、通过  窗体布局窗口  可以在设计时直观地调整窗体在屏幕的位置。

10、要想在代码中给名为 txtshow 的文框赋予文本:GOOD WORK!时,应当编写的语句是  txtshow.text=” GOOD WORK!”  。

11、若命令按钮的名称为Cmdopen,程序要求单击以上命令按钮,打开一个窗口frml,请对以下事件过程填空。

Private Sub Cmdopen     click()  Frm1.show  End Sud 12、事件就是对象上所发生的事情,Visual Basic中的事件如 单击  、  装入  、鼠标移动 等。一个对象响应的事件可以有  多 个,用户不能建立新的事件。事件过程是指  响应某个事件后所执行的代码  。假设某一事件过程如下:
Private Sub cmd1_Click() Form1.Caption=”VB示例” End Sub 则响应过程的对象名是  cmd1  ,事件名是  Click  。      13、对象的方法用于 在对象上实施某种操作功能  。当方法不需要任何参数并且也没有返回值,调用对象的方法格式为  对象名.方法名  ,例如,对窗体Form1 使用Show 方法,应写成  Form1 .Show  。

14、为了在编写代码时能自动语法检查,必须执行 工具   菜单中的  选项   命令,打开  选项  对话框,然后选择“编辑器”选项卡中的 自动语法检测 。

15、定时器(Timer)控件可识别的事件是 Timer ,了生该事件的时间间隔定时由定时器的  Interval 属性设置,其单位为 毫秒 。   1.菜单一般有_下拉式_和_弹出式__两种基本类型。

2.通用对话框控件可显示的常用对话框有_打开_、_保存_、_颜色_、_字体_、_打印_。

3.组合框具有__文本框_和__列表框_两种控件的基本功能。

4.要使数组的默认下标从“1开始,则应在窗体或标准模块代码的声明部分使用语句__Option Base 1_. 5.调用Sub过程时,使用__call__语句,语句用于把程序控制传送到一个Visual Basic的Sub过程。

6.若已建立了Form1和Form2两个窗体,默认启动窗体为Form1。通过_工程_菜单__属性_命令的_通用_选项卡,可将启动窗体设置为Form2。在程序中若要显示Form1窗体,则执行_Form1.show_语句。

7.列表框中项目的序号是从_0_开始的。

8.Sub过程与Function过程最根本的区别是_Sub过程名无返回值,Function过程名有返回值 。

9.VB的代码存储在模块中。在VB中提供了三种类型的模块:_类模块_、_窗体模块__和_标准模块_. 10.使用Hide方法会隐藏被调用的窗体,但是在调用Hide方法之后不会把窗体卸载_,被调用的窗体中的属性已处于内存中。11.将下列数学式子写成VisualBasic表达式。

  ⑴  答:2*cos(a)*sin(a)/(2*a) ⑵答:sqr(s*(s-a)*(s-b)*(s-c)) ⑶sin45°:sin(45*2*3.1415/360)_ 12.将下列数学式子各条件写成VisualBasic逻辑表达式。

  ⑴1≤x<12: 1<=x and x<12 ⑵A+B≥C或a-c≤c: (A+B)>=C OR (a-c)<=c   ⑶a和b都为正整数或同为负数: (a>=0 and b>=0) or (a<=0 and b<=0) 13.设A=2,B=3,C=4,D=5。表达式Not A<=C Or4*B^2 And B< >A+C的值为_False_。

14.在Visual Basic语言中有三种形式的循环结构。其中,若循环的次数可以事先确定,可使用_For…next__循环;
若要求先判断循环进行的条件,可使用_Do while…loop_循环或_ while…Wend_循环。

15.以下语句的输出结果是__3_。

a%=3.14159 Print a% 1、如果要新建一个顺序文件,用Open语句时,操作方式关键词是 output 。

2.在Visual Basic程序中实现复制文件“C:\command.com”到D:盘根目录下的语句为 filecopy  “c:\command.com”,”d:\” 。

3. 在Visual Basic程序中实现删除文件”D:\tem.tmp”的语句为__kill ”d:\tem.tmp” 。

4.按文件号为1打开顺序文件SEQNEW.DAT,用于写入数据,语句为___open ”SEQNEW.DAT” for output as  # 1 。

5.按文件号为2打开顺序文件SEQOLD.DAT,用于从该文件读出数据,语句为___open ”SEQOLD.DAT” for input as #2 。

6.若窗体的左上角坐标为(-200,250),右下角坐标为(300,-150),则X轴的正向向 右 ,Y轴的正向向 上_。

7.Stretch属性设置为_false_时,图像框可自动改变大小以适应其中的图形. 8.在图片框Picture1中画一个左上角在(500,500),边长为500的红色实心正方形的语句为_picture1.line (500,500)-step(500,500), vbred , BF 。

9.设   CurrentX=50,CurrentY=100,执行指令”line(100,20)-Step(300,500)”后,Current=_(400,520)_. 10.使用ADO模型时,可通过ActiveConnect属性建立Recordset和Connection对象的连接. 11.VB中将数据库分为本地数据库、 远程数据库和__外部数据库_三种类型. 12.采用ADO模型时,当使用Open方法打开一个记录集后,与ADOrs.Fields(“学号”)等效的语句是_ADOrs(“符号”)_. 13.ADO模型中一般可通过Connection对象的Execute方法执行增加__、删除_、修改_等三类不返回结果集的SQL语句. 14.设StrSQL、Str1为字符串变量,其中Str1的值为”001”,那么执行赋值语句StrSQL=”Select * from Tabel1 Where学号=’”+Str1+”’”后,StrSQL的值等于_”select. * from tabel1 where 学号=’001’”_. 15.在VB中,将Foxpro称为外部数据库,Access称为__本地数据库_,SQL Server称为__远程数据库__. 1、使用Winsock控件时,一旦有数据到达,将首先触发该控件的DataArrival事件。而如果要发送数据,则通常使用该控件的senddata方法。

2、Winsock控件主要用来编制或基于TCP/IP经UDP协议的通话程序。

3、ActiveXEX文件的后缀是exe。

4、COM对象有两种类型接口,即标准接口和用户接口。

5、如果希望得到本地计算机的IP地址,可以使用Winsock控件的localIP属性。

6、Winsock控件的BytesReceived属性返回接受到的数据,通常使用getdata方法来获取这些数据了。

7、Winsock1.Listen语句的含义是使服务程序处于侦听状态等待客户访问。

8、常用中的VB网络编程控件主要有Winsock 、Internet Transfer、WebBrowser 三种。

9、VB中的程序错误类型主要有编译错误、逻辑错误、实时错误等三种。

10、 VB中用于关闭错误捕获机制的语句是on error goto 0。

1.Visual Basic中有一种控件组合了文本框和列表框的特性,这种控件是_组合框______。

2.Visual Basic提供的对数据文件的三种访问方式为随机访问方式,__顺序访问方式_______和二进制访问方式。

3.为了能在运行时把d:\pic文件夹下的图形a.jpg装入图片框Picture1,所使用的语句为_____Picture1.picture=LoadPicture(“d:\pic\a.jpg”)______。

4.计时器控件能有规律的以一定时间间隔触发__Timer_____事件,并执行该事件过程中的程序代码。

5.Visual Basic应用程序中标准模块文件的扩展名是__.bas__________。

6.与数学表达式cos2(a+b)÷(3+x)+5对应的Visual Basic表达式是__(cos(a+b))^2/(3*x)+5___________. 7.要同时选定窗体上的多个控件,可以按住__Shift____或___ Ctrl____键,然后依次单击窗体上的各控件. 8.在Visual Basic中最基本的对象是___窗体_______. 1. 要在Visual Basic工程中添加一个新的窗体,可以在主窗口的工具栏中选择_添加窗体______按钮. 2. 在代码窗口中,输入某行代码并按回车键之后,如果代码变成__红色____颜色,说明该行代码有语法错误. 1、什么是可视化编程和事件驱动?            答:可视化编程是指无须编程,仅通过直观的操作方式即可完成界面的设计工作的这种编程方式。

当VB的应用程序运行后,系统处于等待状态,当某个事件发生后,程序就去执行此事件的事件过程,当这个事件过程执行完后,系统又处于等待另一个事件发生的状态,这就是事件驱动程序方式。

2、对象、属性、事件和文件之间的关系如何? 答:对象是代码和数据的封装体。对象的操作通过与该对象有关的属性、事件、方法来描述。

属性是一个对象的基本特性,每个对象都有它自己的属性。方法是对象要执行的动作。事件是在对象上所发生的事情。

3、简述事件驱动机制与传统编程方式的不同。答:传统的面向过程的应用程序中,应用程序自身控制了执行那一部分代码按何种顺序执行代码,程序从第一行代码开始执行并按应用程序中预定的路径执行,用户无法改变程序的执行流程。而事件驱动机制则由用户来决定执行的路线。这就是两者的不同。

4、简述事件驱动的工作过程。答:事件驱动的工作过程如下:(1)启动应用程序,装载和显示窗体。(2)窗体或窗体上的控件等待事件的发生。(3)当某个事件发生后,执行其对应的事件过程代码。(4)重复执行(2)和(3),直到遇到END语句或单击“结束”按钮停止程序的运行。

1、简述基于Sock e t的通信过程。

  答:Socket在计算机提供了一个通信端口,可以通过这个端口与任何一个也同时具有Socket接口的计算机进行通信,应用程序在网络上传输、接收的信息都通过这个Socket接口实现,只需要对Socket接口进行数据的读写操作就可以了。

2、简要设计错误处理程序的3个步骤。

(1)捕捉错误,并强制程序跳转(2)编写错误处理程序,对所有可预见的错误作出反应(3)退出错误处理程序 3、简述常用的程序调式技巧 (1)事先做好备份(2)分离受怀疑的程序(3)缩小搜索范围(4)使用MSGBOX语句 4、简述基于Winsock控件的开发模式。

(1)服务器程序的开发模式:(A)服务器程序必须设置好LOCALPORT,作为侦听端口,该值可设置成任意一个整数,只要其他应用和谐没有使用过的值均可,但习惯上应大于1000(B)使用LISTRN方法使用服务器进入侦听状态,等待客户机程序的连接请求。(C)客户机程序发出连接请求后,将触发服务器程序的CONNECTIONREQUEST事件,该事件得到一个参数REQUESTID。(D)服务器程序使用ACCEPT方法接受客户机程序的REQUESTID请求,至此,服务器程序就可以使用SRNDDATA方法向客户机发送数据了。此时应特别注意两点:一是ACCEPT方法必须用到上一步的REQUESTID作为其参数;
二是在执行ACCEPT方法前,服务器仍处于侦听状态,此时应首先使用CLOSE方法关闭服务器,然后再调用ACCEPT方法。(E)当服务器程序接收到数据时,会产生DATAARRIVAL事件。在该事件中可以使用GETDATA方法接收数据。

(2)客户机程序的开发模式:(A)客户程序首先应设置好REMOTEHOST属性,用来指向运行器程序的主机名或IP地址 (B)设置REMOTEPORT属性,用来指向服务器程序和侦听端口号。(C)使用CONNECT方法向服务器提出连接请求。

(D)如果服务器接受上述连接请求,客户机程序会产生CONNECT事件。可以根据需要,在此事件中编写程序,比如使用MSGBOX函数向用户提示“连接已成功”之类的信息。(E)连接成功之后,就可以根据需要使用SENDDATA方法向服务器发送数据了。

(F)当客户机程序接收到数据时,会产生DATAARRIVAL事件,可以用GETDATA方法接收数据。

1. 简述多文档及其特性。

答:定义:多文档界面(MDI,Multiple Document Interface)允许创建在单个容器窗体中包含多个窗体的应用程序。绝大多数基于Windows的大型应用程序都是多文档界面,例如,Microsoft Word和Microsoft Excel等。多文档界面可同时打开多个文档,它简化了文档之间的信息交换。

多文档界面有如下特性:
所有子窗体均显示在MDI窗体的工作区中。用户可以改变、移动子窗体的大小,但被限制在MDI窗体中。

当最小化子窗体时,它的图标将显示在MDI窗体上,而不是在任务栏中。当最小化MDI窗体时,所有的子窗体也被最小化,只有MDI窗体的图标出现在任务栏中。

当最大化一个子窗体时,它的标题与MDI窗体的标题一起显示在MDI窗体的标题栏上。

MDI窗体和子窗体都可以有各自的菜单,当子窗体加载时覆盖MDI窗体的菜单。

2. 简述对话框的分类和特点。

答:分类:对话框分为3种类型:预定义对话框、通用对话框和自定义对话框 预定义对话框也称预制对话框,是由系统提供的。VB提供了两种预定义对话框,即输入框和信息框(或消息框),前者用InputBox函数建立,后者用MsgBox函数建立,具体用法参见第4章。

通用对话框是一种控件,用这种控件可以设计较为复杂的对话框。

自定义对话框也称定制对话框,这种对话框由用户根据自己的需要进行定义。输入框和信息框尽管很容易建立,但在应用上有一定的限制,很多情况下无法满足需要,用户可以根据具体需要建立自己的对话框。本章将介绍后两种对话框,即通用对话框和自定义对话框。特点:在一般情况下,用户没有必要改变对话框的大小,因此其边框是固定的。

为了退出对话框,必须单击其中的某个按钮,不能通过单击对话框外部的某个地方关闭对话框。

在对话框中不能有最大化按钮(Max Button)和最小化按钮(Min Button),以免被意外地扩大或缩成图标。

对话框不是应用程序的主要工作区,只是临时使用,使用后就必须关闭。

1.当x的输入值分别为4、8和12时,写出执行下列事件过程的输出结果。

Private Sub Command1_Click() Dim x%, y% x = InputBox(“请输入x的值:“) Select Case x Case 1, 3, 5 ,7 y = x + 10 Case 8 To 10 y = x + 2 Case 2, 4, 6 y = 5 * x Case Is > 10 y = x * x + 1 End Select Print “x=“; x, “y=“; y End Sub x=4 y=20 ( 记得换行)
x=8 y=10 ( 记得换行)
x=12 y=145 2. 写出执行下列事件过程的输出结果。

Private Sub Command1_Click() Const n = 3 Dim i As Integer, k As Integer For i = 1 To n Print Tab((n - i) * 2 + 1); 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

Next k For k = i - 1 To 1 Step -1 Print Str(k); Next k Print Next i End Sub 1 1 2 1 1 2 3 2 1 3.设在一个窗体(如图所示)中已设置了一个组合框Combo1和文本框Text 1,且有下列程序,试写出事件过程Combo1_Click的功能。

Dim str As String Private Sub Form_Load() str = “ “ Combo1.AddItem “北京“ Combo1.AddItem “天津“ Combo1.AddItem “西安“ Combo1.AddItem “上海“ Combo1.AddItem “武汉“ Combo1.AddItem “广州“ Combo1.AddItem “海口“ Combo1.Text = “北京“ End Sub Private Sub Combo1_Click() str = str & Combo1.Text & “,“ Text1.Text = str End Sub 在文本框中显示单击组合框列表项目时该项目的内容,而且以后来添加的方式在文本框中显示所有选择项目的内容。

4. 写出执行下列事件过程的输出结果。

Private Sub Form_Click() Dim a(1 To 2, 1 To 2) As Integer Dim i As Integer, j As Integer For i = 1 To 2 For j = 1 To 2 a(i, j) = (2 * i - 1) * 4 + j Next j Next i For i = 1 To 2 Print a(i, 3 - i), a(3 - i, i) Next i End Sub 6 13 ( 记得换行)
13 6 5.写出执行下列事件过程的输出结果。

Private Sub Command1_Click() Dim a As Integer, b As Integer a = 3: b = 2 Call f(8, a) Print “a=“; a, “b=“; b Call f(a, b) Print “a=“; a, “b=“; b End Sub Private Sub f(ByVal x As Integer, y As Integer) x = x + 1 y = y - 1 End Sub a=2 b=2 ( 记得换行)
a=2 b=1 6.若有如下窗体模块:
Dim a As Integer Private Sub test() 。。。。。。。。。。。。。。。。。。。。。。。。。。。Private Sub Command1_Click() a = 2: b = 3 Call test Call test End Sub 写出当程序启动并单击命令按钮后,在窗体中显示的结果。Sub:
3 1 (记得换行)
Sub:
4 1   1. 下面事件过程的功能是:输入某个学生某门课程的百分制成绩,并根据成绩输出评语,若0≤成绩<60 时,评语为“差”;
若60≤成绩<70时,评语为“通过”;
若70≤成绩<80时,评语为“中等”;
若80≤成绩<90时,评语为“良好”;
若90≤成绩≤100时,评语为“优秀”,在横线上填上适当内容。

Private Sub Command1_Click() Dim s! s = InputBox(“请输入学生的成绩:“) If 0<=s And s<=100 Then Select Case (1) s ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, (2) Case Else或Is >=0 Print “差“ End Select End If End Sub 2.下面程序的功能是:计算 f=1 -1/(2×3)+1/(3×4)-1/(4×5)+ … +1/(19×20)的值,在横线上填上适当内容。

Private Sub Form_Click() Dim f As Single,i As Integer,sign As Integer (3)
sign=-1 f = 1 (4)
for i=2 to 19 f = f + sign/(i*(i + 1)) (5)
sign=sign*(-1) Next i Print “ f= “; f End Sub 3.下面窗体模块的功能是:从键盘上输入x,y和z的值,按如下公式求f (x,y,z)的值的程序,在横线上填上适当内容。

f(x,y,z)=sin(x)/(sin(x-y)*sin(x-z))+sin(y)/(sin(y-z)*sin(y-x))+sin(z)/(sin(z-x)*sin(z-y)) 其中x、y和z互不相等。

Function f(ByVal a As Single,ByVal b As Single,ByVal c As Single) (6) As Single (7) f=Sin(a)/(Sin(b)* Sin(c)) End Function Private Sub Command1_Click() ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,s=f(x,x-y,x-z)+f(y,y-z,y-x)+ (8) f(z,z-x,z-y) Print “s=“; s Else Print “数据输入错误!“ End If End Sub 4.下面事件过程的功能是从学生分数顺序文件D: \file1.dat中读取各个学生的分数,并求该班的平均成绩,在横线上填上适当内容。

Private Sub command1_Click() Dim n%, score!, s! Open “D:\file1.dat“ (9) As #3 For Input n = 0: s = 0 While (10) Not EOF(3) Input #3,score s = s + score n = (11) n+1 Wend Print “平均成绩为:“; s / n Close #3 End Sub 1. 假设体操比赛有10个评委和评分规定为:①采用10分制;
②去掉一个最高分和去掉一个最低分,然后计算平均分,该平均分作为最后得分。试编写一个事件过程,输入10个评委对某个运动员的评分存放在一维数组s中,计算该运动员的最后得分。

Private Sub Command1_Click() Dim s!(1 To 10), max!, min!, i%, sum! max = 0: min = 11: sum = 0 For i = 1 To 10 s(i) = InputBox(“请输入第“ & Str(i) & “个评委的分数“) Next i For i = 1 To 10 If s(i) > max Then max = s(i) If s(i) < min Then min = s(i) sum = sum + s(i) Next i Print “最后得分:“; (sum - max - min) / 8 End Sub 2. 勾股定理中的三个数a、b和c的关系为:。试编写一个事件过程,求出30以内满足上述关系的整数组合并输出。例如,3、4和5就是这样一个整数组合。

Private Sub Command1_Click() Print “a“,“b“,“c“ For a = 1 To 30 For b = 1 To 30 For c = 1 To 30 If a*a+b*b=c*c Then Print a,b,c Next c Next b Next a End Sub 1、在窗体上添加一个文本框和两个命令按钮,并把两个命令按钮的标题分别设置为“隐藏文本框”和“显示文本框”。当单击第一个命令按钮时,文本框消失;
而当单击第二个命令按钮时,文本框重新出现,并在文本框中显示“VB程序设计”(字体大小为16)。程序运行界面如图所示。

解:“隐藏文本框”按钮中的代码为:Text1.Visible=False “显示文本框” 按钮中的代码为:Text1.Visible=True  Text1.Text=”VB程序设计” Text1.FontSize=”16” 2、设计一个计算程序。该程序用户界面如图2所示,由四个文本框:文本框1(text1)、文本框2(text2)、文本框3(text3)、文本框4(text4),和三个按钮:命令按钮1(command1)、命令按钮2(command2)、命令按钮3(command3)组成。程序运行后,用户按清除按钮,则清除文本框中显示的内容,按计算按钮,则计算三科平均成绩。单击退出按钮则退出。

解:command1中的代码为:text1=””:
text2=””:
text3=””:
text4=”” command2中的代码为:text4=(val(Text1)+ val(Text2)+ val(Text3))/3 command2中的代码为:End 3、编写一收款计算程序。要求用户输入商品的“单价”、“数量”和“折扣”后,单击“计算”按钮显示“应付款”,单击“清除”按钮,清除文本框中所有的数据。程序运行界面如图3所示。

答:“计算”按钮的代码:text4=val(Text1)* val(Text2)* val(Text3)/100 “清除”按钮的代码:text1=””:
text2=””:
text3=””:
text4=”” 1、Private Sub Form_Click( )         Static Sum As Integer         For I= 1 to 100          Sum=Sum+I         Next I Print Sum End Sub 程序运行结果为:1+2+…….+99+100=5050 2、private Sub Form_Click( )      A=10: b=15:c=20:d=25      Print A;Spc(5);b;Spc(7);c      Print A;Spc(8);b;Space$(5);c      Print c;Spc(3);”+”;Spc(3);c+d    End Sub 10(5个空格)15(7个空格)20 10(8个空格)15(5个空格)20 20(三个空格)+(三个空格)45 3、Private Sub Form_click( )      For i% =1 to3        Forj% = 1 to i       Print L Trim(Str(i%))+ “*”+L Trim(Str(j%))+ “=”;i% * j%;           Next j%         Print Next i% End Sub 1*1= 1 2*1= 2  2*2= 4 3*1= 3  3*2= 6  3*3= 9 4、Private Sub Command1_Click( )   Dim a,b As Integer    A=3.4 B=3.4 Text1.Text=a Text2.Text=b End Sub Text1显示3 、4 (记得换行)
Text2显示3 5、Private Sub Form_Click()      For I =1 to 5         Print Tab( 11 – I )       For J =1 To I * 2 – 1               Print “*”;         Next        Next i End Sub                *               ***              *****             *******            ********* 1、购物优惠程序。某商场为了加速促成商品流通,采用购物打折的优惠办法,每位顾客一次购物(1)在100元以上者,按九五折优惠;
(2)在200元以上者,按九折优惠;
(3)300元以上者,按八折优惠;
(4)500元以上者按七折优惠。在窗体上添加两个文本框和一个命令按钮,要求在Text1中输入购物商品总金额,单击命令按钮,在Text2中输入优惠后的价格。程序运行结果如图解所示。

 If Val(text1)>=500 then text2=Val(text1)*0.7 Else if Val(text1)>=300 then text2=Val(text1)*0.85   Else if Val(text1)>=200 then text2=val(text1)*0.9   Else if val(text1)>=100 then text2=val(text1)*0.95 End if                                    2、输出100~200之间不能被3整除的的数,要求用Do语句的一种形式来实现,程序运行结果如图5所示。

窗体的装入事件中加入如下代码:
Dim a as integer A=100 Do while a <=200 If (a mod 3)<> 0 then List1.additen str(a) End if A=a+1 loop 3、编写程序,打印如下的乘积表:
Dim I ,j as integer Print”*”:space(5): For i=3 to 12 step 3  Print str(i);space(5); Next i Print For I = 15 to18 Print str(i);space(3); For j=3 to 12 step3 Print str(i*j);space(4); Next j Print Next j 4、设计一个计算程序。该程序用户界面如图7所示。要求程序运行后,用户选中单击选按钮,则程序作10和2的相应计算,并把计算结果在文本框中显示出来。如用户选中加法单选按钮,则程序作10和2的相加,计算结果12在文本框中显示出来。按结束,则退出。

乘法单选按钮的单击事件中添加如下代码:
Text1=10*2 除法单选按钮中添加如下代码:
Text1=10/2 加法单选按钮中添加如下代码:
Text1=10+2 减法单选按钮中添加如下代码:text1=10-2 结束按钮中代码: end 或unload me 5、编写输入一个0~6数字,显示汉字对照输出星期的Function过程。程序运行结果如图8所示。

文本框的change事件中代码如下: Select case val(text1) Case 0 Label1.caption=”星期天”+chr(13)+”(Sunday)” Case 1 Label1.caption=”星期一”+chr(13)+”(monday)” Case2 Label1.caption=”星期二”+chr(13)+”(Tuesday)” Case 3 Label1.caption=”星期三”+chr(13)+”(wednesday)” Case 4 Label1.caption=”星期四”+chr(13)+”(thursday)” Case 5 Label1.caption=”星期五”+chr(13)+”(firday)” Case 6 Label1.caption=”星期六”+chr(13)+”(saturday)” End select 6、编写一个程序,当鼠标移到Picturel控件时,鼠标指针改变形状;
当在Picturel控件上单击鼠标右键时,通过消息框显示“You pressed right button”,并再次改变鼠标指针的形状。

Picture1_mouseup If button=2 then I=1 Msgbox” you pressed right button” End if End sub 7、列表框应用程序。要求从文本框中输入姓名,然后按“添加”按钮,把姓名添加到列表框中;
当选择列表框中某一项时,按“删除”按钮,从列表框中删除;
当列表框中某一项时,按“修改”按钮,把列表框中选取的项送往文本框且“修改”按钮变为“修改确认”。在文本框的内容修改好后,按“修改确认”按钮,再把文本框中修改后的信息送到列表框且“修改确认”按钮变为“修改”。程序运行结果如图9所示。

添加按钮代码:list1.additem text1.text Text1.text=”” 删除: if list1.text<>”” then List1.removeitem =list1.listindex End if 修改:If command3.caption=“修改” then Text1.text=list1.text Command3.caption=”修改确认” Else If  command3.caption=”修改确认” then List1.list=list1.listindex>=text1.text Command3.caption=”修改” End if End if 1、在窗体上建立一个驱动器列表框、目录列表框、文件列表框、图片框。要求程序运行后,驱动器列表框Drive1的默认驱动器设置为C盘,选择File1中所列的确图片文件(*.Bmp和*.jpg),则相应的图片显示在图片框Picture1中。程序运行结果如图10所示。

解:依据图10设计界面,文件列表框的pattern属性设置为:*.Bmp ; *.jpg 驱动器列表框的change事件中添加如下代码:chdrive drive1.drive dir1.path=drive1.drive 目录列表框的change事件中添加如下代码:chdir dir1.path file1.path=dir1.path 文件列表框的click事件中添加如下代码:picture1.picture=loadpicture file1.filename 2.余弦曲线的方程为y=cosx,画出x从-2到2的确余弦曲线,并在坐标轴上标出刻度,如图11所示。

如图窗体的单击事件中添加如下代码:
Form1.scale ( -2*3.14159,1)- (2*3.14159, -1) Form1.line (-2*3.14159,0)- (2*3.14159,0) Form1.line (0,1)-(0,-1) Form1.currentx =0.2:form1.currentY= -0.1:print ”0” Form1.currentx =-3.2:form1.currentY= -0.1:print ”-pi” Form1.currentx =3.3:form1.currentY= -0.1:print ”pi” Form1.currentx =-6.2:form1.currentY= -0.1:print ”-2pi” Form1.currentx =5.7:form1.currentY= -0.1:print ”2pi” Form1.currentx =0.2:form1.currentY= 0.5:print ”0.5” Form1.currentx =0.2:form1.currentY= -0.5:print ”-0.5” For I =-6.282 to 6.282 step 0.08  Form1.pset(I, cos(I))   Next I 3,使用Line控件显示直线,并且可以显示直线的线宽和线型.程序运行界面如图12所示. 如图 添加代码如下 复选框的单击事件代码:
If check1.value =1 then   Line1.border width =4 Else Line1.border width = 1 End if 实线、虚线、单选框要弄成一个option1单选框控件数组。单选框单击事件代码:
Select case index  Case 0 Line1.borderstyle = 1  Case 1 Line1.borderstyle = 2  Case 2 Line1.borderstyle = 3 End select 4.使用Shape控件显示几种图形,并可以设置图形的边框和填充效果等.程序运行界面如图13所示. 首先按图作出程序界面。形状框架里的单选框要做成option1控件数组,边框类型框架里的单选框最成option2控件数组,填充风格框架里的单选做成option3控件数组。

Option 1单击事件代码如下:
Select case index Case 0 Shape1.shape = 0 Case 1 Shape1.shape = 1 Case 2 Shape1.shape = 3 Case 3 Shape1.shape = 4 End select Option 2单击事件代码如下: Select case index Case 0 Shape1.borderstyle = 0 Case 1 Shape1. borderstyle = 2 Case 2 Shape1. borderstyle = 1 Case 3 Shape1. borderstyle = 3        Case 4 Shape1. borderstyle =4 End select Option 3单击事件代码如下:   Select case index Case 0 Shape1.fillstyle = 1 Case 1 Shape1. fillstyle = 1 Case 2 Shape1. fillstyle = 3 Case 3 Shape1. fillstyle = 6 End select 5.使用SQL Server或Access建立名称为”学生的数据库,并在其中创建”students”的数据库表,其结构及初始记录如表1所示.使用ADO对象和MSFlexGrid控件设计数据库列表显示程序.程序的设计界面和运行结果如图14、图15所示。

                    表1 学号      姓名      专业 2004001      张红      软件专业 2004003      李强      会计专业 2004002      王丽      软件专业 声名对象变量ADOcn,用于创建与数据库的连接 Private ADOcn As connection Readfromtable Private sub readfromtable( ) Dim strtmp As string Dim ADOrs As new recordset ADOrs.activeconnection =ADOcn ADOrs.open “select*from students order by “学号” MSFlexgrid1.clear MSFlexgrid1.rows = 0 MSFlexgrid1.cols = 3 Strtmp = “学号”+vbtab+“姓名”+vbtab+“专业” MSFlexgrid1.additem strtmp Do while not ADOrs.eof Strtmp=ADOrs(“学号”)+vbtab+ADOrs(“ 姓名”)+vbtab+ADOrs(“专业”) MSFlexgrid1.addttem strtmp ADOrs movenext Loop MSFlexgrid1.fixedcols = 0 MSFlexgrid1.fixedrows = 1 End sub Private sub form_load() Dim strDB As string strDB=”provider=SQLOLEDB;LSF;User ID=sa;password=;database=学生” if ADOcn is nothing then set ADOcn=new connection ADOcn.open strDB End if Readfrom table End sub Private sub command1_click() Unload me End sub 1、利用冒泡排序算法开发以下程序,请指出程序中存在的错误并改正。

Private Sub Command1_Click() Dim A( 1 To 20 )As Integer Dim c , j , T As Integer       '此处有错,应为Dim c ,j ,T as integer           ‘随机生成一组数据 For c= 1 To 20     A(c) = Int ( Rnd *100 ) Next c ‘排序 For c = 1 To 20     For j = c+ 1 To 20        IF A(c)>A( j )Then          T=A ( j )          A( j )=A (c)          A( j )=T           '此处有错,应为A(C)=T,实现           End If      'A(C)和A(J)的交换               Next Next ‘在窗体上输出结果 Cls For c = 1 To 20     Print A ( i )       '此处有错,应为A(C).下标越界.         Next c End Sub 2、利用Winsock控件开发一个点对点聊天系统,该系统由一个服务器应用程序和一个客户端应用程序组成,能够实现网络中两台计算机间的通话任务。

解:如下界面的设计中,若不说明,各对象均采用默认的名称。

         服务器程序的界面设计 1、创建一个“标准EXE”工程。选中“工程”菜单的“部件”选项,在控件中找到Microsoft Winsock Control 并将其选中。如果没有找到,通常是由于VB安装不安全的缘故,可以找到安装盘并安装其中的Mswinsck.cad 压缩包。

2、将form1的名称改为 frmSvr ,并在其中添加一个命令按钮控件,将其Caption属性修改为“退出”。

3、在窗体上添加三个添加TextBox控件,分别将其名称修改为txtServerIP , txtSend 和txtReceive,用来显示服务器的IP地址和需收发的信息。(无答案)
4、在窗体上添加一个Winsock控件,将其名称改为WinsockServer,将Protocol(协议)属性设置为0(即sckTCPProtocol)
各控件及事件代码如下:
Private Sub Command1_Click() Unload Me End Sub   Private Sub Form_Load() txtreceive.Text = ““ txtsend.Text = ““ Winsockserver.LocalPort = 10001 txtserverip.Text = Winsockserver.LocalIP Winsockserver.Listen End Sub   Private Sub txtsend_Change() Winsockserver.SendData txtsend.Text   End Sub   Private Sub Winsockserver_ConnectionRequest(ByVal requestID As Long) Winsockserver.Close Winsockserver.Accept requestID End Sub   Private Sub Winsockserver_DataArrival(ByVal bytesTotal As Long) Dim mystr As String Winsockserver.GetData mystr txtreceive.Text = mystr   End Sub   客户机程序的界面设计 1、与服务器程序类似,创建一个新的“标准EXE”工程,并添加Winsock控件。

2、将form1的名称改为 frmClt,并添加两个命令按钮控件,分别将它们的Caption属性设置为“退出”和“连接聊天服务器”。

3、在窗体添加四个文本框控件,分别将其名修改为txtClientIP, txtSenerIP, txtsend和txtReceive,用来显示客户机和要连接的服务器的IP地址以及需收发的信息。

4、在窗体上添加一个Winsock控件,将其名称改为WinsockClient,将(协议)属性设置为0(即sckTCPProtocol)
各控件及事件代码如下:
Private Sub Command1_Click() Unload Me End Sub   Private Sub Command2_Click() Winsockclient.RemoteHost = txtserverIP.Text Winsockclient.Connect End Sub   Private Sub Form_Load() txtreceive.Text = ““ txtsend.Text = ““ Winsockclient.RemotePort = 10001 txtclientIP.Text = Winsockclient.LocalIP   End Sub   Private Sub txtsend_Change() Winsockclient.SendData txtsend.Text   End Sub   Private Sub Winsockclient_Connect() MsgBox “你成功地与聊天室服务器进行了联接“, vbInformation End Sub   Private Sub Winsockclient_DataArrival(ByVal bytesTotal As Long) Dim mystr As String Winsockclient.GetData mystr txtreceive.Text = mystr   End Sub 1. 程序功能:已知24有8个正整数因子(即:1,2,3,4,6,8,12,24),而24正好被其因子个数8整除。问[100,300]之间有多少个这样的数。程序中有两行有错误。改正错误,使它能输出正确的结果。

Private Sub Command1_Click() Dim n1 As Integer, n2 As Integer Dim x As Integer Dim i As Integer n2 = 0 For x = 100 To 300 n2 = 0 n2 = 0 改成 n1 = 0 For i = 1 To 100 For i = 1 To 100改成 For i = 1 To x If x Mod i = 0 Then n1 = n1 + 1 End If Next i If x Mod n1 = 0 Then n2 = n2 + 1 End If Next x Print n2 End sub 2.程序功能:利用函数pd计算1~5000之间能被17和37整除的数的个数。程序中有错误,改正错误,使程序能输出正确的结果。

Private Sub Command1_Click() Dim i As Integer Dim s As Integer s = 0 For i = 1 To 5000 If pd(i) Then s = s + 1 Next i Print s End Sub Private Function pd(x As Integer) As Boolean If x Mod 17 = 0 Or x Mod 37 = 0 Then  Or 改成 And pd = True Else pd = False End If End Fuction 3. 程序功能:根据整型参数m,计算100-999的平方根的倒数之和。程序的函数fun()中有一行有错误,改正错误,使它能输出正确的结果。

Private Sub Command1_Click() Print Format(fun(100, 999), “#.######“) End Sub Private Function fun(m As Integer, n As Integer) As Single y = 0 For i = m To n t = 1 / Sqr(i) y = y + t Next i fun = t fun = t 改成 fun = y End Function 1.士兵在演练过程中,队伍变换成10、21、35、60行时,队形都能成为矩形。问参加演练的士兵最少有多少人? Private Sub Form_Click() Dim a%, b%, c%, d%, n% a = 10 b = 21 c = 35 d = 60 n = 60 Do While ______(a * 1000 + b * 100 + c * 10 + d) * e = b * 1000 + c * 100 + d * 10 + e__________________________ n = n + 1 Loop Print n End Sub 2. 用cos(x)≈1-x^2/2!+x^4/4!-……+(-1)^(n)*(x^(2n))/(2n)!的公式求近似值,直到最后一项绝对值小于0.00001为止。设x=7。

Private Sub Form_click() Dim x As Integer, i As Integer Dim xpower As Single Dim y As Single x = Val(InputBox(“请输入x:“)) i = 0 z = 1 y = 1 Do While Abs(z) > 0.00001 factor = 1 i = i + 1 For j = 1 To 2 * i factor = factor * j Next j xpower = x ^ (2 * i) ________100 - i - j = (100 - 5 * i - j) * 2________________________ y = y + z Loop Print format(y, “0.######“) End Sub 3. 已知一个数列的前3项为0,0,1,从第4项开始,每项为前3项的和,编程求此数列的第39个数。

Private Sub Form_Click() Dim i%, f0&, f1&, f2&, f3& FontSize = 14: FontBold = True f0 = 0 f1 = 0 f2 = 1 For i =4 to 39 ___c = (i Mod 100) \ 10_____________ f0 = f1 f1 = f2 f2 = f3 Next i Print f3 End Sub 1、编写程序,验证输入的3位正整数是否为同构数。X若出现在自己的平方数的末3位,则X是同构数。如625的平方是390625,则625为同构数。

Private Sub Command1_Click() Dim i, m As Integer For i = 100 To 999 m = (i * i) Mod 1000 If i = m Then Print i End If Next i End Sub 2.设有如下两组数据:
A: 1, 2,3, 4, 5,6, 7, 8, 9, 10 B: 100, 99, 98, 97, 96, 95,94, 93, 92, 91, 编写一个程序,把上面两级数据分别读入两个数组中,然后把两个数组中对应的元素相加,即1+100……10+91。并把相应的结果放入三个数组中,最后输出第3个数组的值。

Private Sub Command1_Click() Dim a(10), b(), c(10) As Integer For i = 1 To 10 a(i) = i Next i b = Array(100, 99, 98, 97, 96, 95, 94, 93, 92, 91) For i = 1 To 10 c(i) = a(i) + b(i - 1) Print c(i) Next i End Sub 3. 用Circle方法画圆弧和椭圆弧。如下图所示。要求:中心点相同,圆弧长度和角度随机,颜色随机,圆弧数为20。

Private Sub Command2_Click() pi = 3.1415926 a1 = 0 c = 1 DrawWidth = 1 For r = 100 To 2000 Step 100 a2 = (a2 + (pi / 2)) Mod (2 * pi) Circle (1800, 1200), r, QBColor(c), a1, a2 a1 = a1 + (pi / 4) c = c + 1 DrawWidth = DrawWidth + 1 Next r End Sub Private Sub Command3_Click() Cls End Sub 4.在图片框中用PSet方法随机地产生若干个彩色的点。窗体上有3个命令按钮:“画点”、“清除”、和“退出”。如下图所示。

PSet方法:[对象名.]Pset[Step](x,y)[,颜色] Private Sub Command1_Click() Picture1.DrawWidth = 10 For i = 1 To 100 r = Int(256 * Rnd) g = Int(256 * Rnd) b = Int(256 * Rnd) x = Rnd * Width y = Rnd * Height Picture1.PSet (x, y), RGB(r, g, b) Next i End Sub Private Sub Command2_Click() Picture1.Cls End Sub Private Sub Command3_Click() End End Sub 请您删除一下内容,O(∩_∩)O谢谢!!!2015年中央电大期末复习考试小抄大全,电大期末考试必备小抄,电大考试必过小抄After earning his spurs in the kitchens of The Westin, The Sheraton, Sens on the Bund, and a sprinkling of other top-notch venues, Simpson Lu fi nally got the chance to become his own boss in November 2010. Sort of. The Shanghai-born chef might not actually own California Pizza Kitchen (CPK) but he is in sole charge of both kitchen and frontof- house at this Sinan Mansions'stalwart.  “It’s certainly a responsibility to be the head chef, and then to have to manage the rest of the restaurant as well,“ the 31-year-old tells Enjoy Shanghai. “In hotels, for example, these jobs are strictly demarcated, so it’s a great opportunity to learn how a business operates across the board.“  It was a task that management back in sunny California evidently felt he was ready for, and a vote of confi dence from a company that, to date, has opened 250 outlets in 11 countries. And for added pressure, the Shanghai branch was also CPK’s China debut.  “For sure it was a big step, and unlike all their other Asia operations that are franchises, they decided to manage it directly to begin with,“ says Simpson.  Two years ago a private franchisee took over the lease, but the links to CPK headquarters are still strong, with a mainland-based 'brand ambassador’ on hand to ensure the business adheres to its ethos of creating “innovative, hearth-baked pizzas“, a slice of PR blurb that Simpson insists lives up to the hype.  “They are very innovative,“ he says. “The problem with most fast food places is that they use the same sauce on every pizza and just change the toppings. Every one of our 16 pizza sauces is a unique recipe that has been formulated to complement the toppings perfectly.“  The largely local customer base evidently agrees and on Saturday and Sunday, at least, the place is teeming. The kids-eat-for-free policy at weekends is undoubtedly a big draw, as well as is the spacious second-fl oor layout overlooked by a canopy of green from Fuxing Park over the road.  The company is also focusing on increasing brand recognition and in recent years has taken part in outside events such as the regular California Week. Still, the sta are honest enough to admit that business could be better; as good, in fact, as in CPK’s second outlet in the popular Kerry Parkside shopping mall in Pudong.  “Sinan Mansions has really struggled to get the number of visitors that were envisaged when it first opened, and it hasn’t been easy for any of the tenants here,“ adds Simpson. “We’re planning a third outlet in the city in 2015, and we will probably choose a shopping mall again because of the better foot traffic.“ The tearooms once frequented by Coco Chanel and Marcel Proust are upping sticks and coming to Shanghai, Xu Junqian visits the Parisian outpost with sweet treats. One thing the century-old Parisian tearoom Angelina has shown is that legendary fashion designer Coco Chanel not only had style and glamor but also boasted great taste in food, pastries in particular. One of the most popular tearooms in Paris, Angelina is famous for having once been frequented by celebrities such as Chanel and writer Marcel Proust. Now Angelina has packed up its French ambience, efficient service, and beautiful, comforting desserts and flown them to Shanghai. At the flagship dine-in and take-out space in Shanghai, everything mimics the original tearoom designed from the beginning of the 20th century, in Paris, the height of “Belle Epoque“. The paintings on the wall, for example, are exactly the same as the one that depicts the landscape of southern France, the hometown of the owner; and the small tables are intentional imitations of the ones that Coco Chanel once sat at every afternoon for hot chocolate. The famous hot chocolate, known as L’Africain, is a luxurious mixture of four types of cocoa beans imported from Africa, blended in Paris and then shipped to Shanghai. It’s sinfully sweet, rich and thick as if putting a bar of melting chocolate directly on the tongue and the fresh whipped cream on the side makes a light, but equally gratifying contrast. It is also sold in glass bottles as takeaway. The signature Mont-Blanc chestnut cake consists of three parts: the pureed chestnut on top, the vanilla cream like stuffing, and the meringue as base. Get all three layers in one scoop, not only for the different textures but also various flavors of sweetness. The dessert has maintained its popularity for a century, even in a country like France, perhaps the world’s most competitive place for desserts. A much overlooked pairing, is the Paris-New York choux pastry and N226 chocolate flavored tea. The choux pastry is a mouthful of airy pecan-flavored whipped cream, while the tea, a blend of black teas from China and Ceylon, cocoa and rose petals, offers a more subtle fragrance of flowers and chocolate. Ordering these two items, featuring a muted sweetness, makes it easier for you to fit into your little black dress. Breakfast, brunch, lunch and light supper are also served at the tearoom, “a hub of many cultures“ and takes in “a mix of different styles of French cuisines“, according to the management team. The semi-cooked foie gras terrine, is seductive and deceptive. It’s generously served at the size and shape of a toast, while the actual brioche toast is baked into a curved slice dipped with fig chutney. The flavor, however, is honest: strong, smooth and sublime. And you don’t actually need the toast for crunchiness. This is the season for high teas, with dainty cups of fine china and little pastries that appeal to both visual and physical appetites. But there is one high tea with a difference, and Pauline D. Loh finds out just exactly why it is special. Earl Grey tea and macarons are all very well for the crucial recuperative break in-between intensive bouts of holiday season shopping. And for those who prefer savory to sweet, there is still the selection of classic Chinese snacks called dim sum to satisfy and satiate. High tea is a meal to eat with eye and mouth, an in-between indulgence that should be light enough not to spoil dinner, but sufficiently robust to take the edge off the hunger that strikes hours after lunch. The afternoon tea special at Shang-Xi at the Four Seasons Hotel Pudong has just the right elements. It is a pampering meal, with touches of luxury that make the high tea session a treat in itself. Whole baby abalones are braised and then topped on a shortcrust pastry shell, a sort of Chinese version of the Western vol-au-vent, but classier. Even classier is the dim sum staple shrimp dumpling or hargow, upgraded with the addition of slivers of midnight dark truffles. This is a master touch, and chef Simon Choi, who presides unchallenged at Shang-Xi, has scored a winner again. Sweet prawns and aromatic truffles — what’s not to love? His masterful craftsmanship is exhibited in yet another pastry — a sweet pastry that is shaped to look like a walnut, but which you can put straight into the mouth. It crumbles immediately, and the slightly sweet, nutty morsel is so easy to eat you’ll probably reach straight for another. My favorite is the dessert that goes by the name yangzhi ganlu, or ambrosia from the gods. The hotel calls it chilled mango cream with sago, pomelo and bird’s nest – made with ingredients that resonate with every female soul. It does taste like ambrosia, with the sweet-sour fragrance of the mango forming the first layer of taste and sensation, and the pomelo sacs and sago pearls providing the tactile contrast. The bird’s nest — it’s the ingredient that gilds the lily, since it is supposed to nourish and nurture a perfect complexion. For those unfamiliar with this exotic ingredient, the bird’s nest is not a bundle of twigs, but is, instead, the dried secretion that cave swifts use to build their nest. Technically, it’s bird saliva, but the Chinese believe that it has collagen-boosting properties essential to beauty. To me, it just tastes good, adding a slight gelatinous crunch to the back of the teeth. There is also a baked mushroom puff pastry that includes the highly prized Matsutake or pine mushroom. You also get a choice of teas, but I strongly recommend the aged Pu’er from Yunnan province. It is a mellow tea that will go perfectly with the rich little nuggets, and will warm you up on a cold afternoon. Incidentally, the general guide is green tea such as Longjing or Dragonwell for the hot season, semi-fermented teas like Wu-long or Iron Buddha for autumn, and more warming teas like Pu’er for winter. The Shang-Xi afternoon tea costs 228 yuan ($37) per person, and 388 yuan for the more opule

推荐访问:vb考试复习资料及答案 最新电大建筑力学机考复习资料及答案小抄 《新编会计综合实训》最新参考答案 【精品】VB_考试复习资料及答案 VB_考试复习资料及答案 《电工电子学》综合复习资料及参考答案 vb实验作业参考答案 电大民族理论期末复习考试小抄

版权所有:心圆文档网 2014-2024 未经授权禁止复制或建立镜像[心圆文档网]所有资源完全免费共享

Powered by 心圆文档网 © All Rights Reserved.。备案号:豫ICP备14024556号-1