[计算机类试卷]VB机试模拟试卷92及答案与解析.doc

上传人:feelhesitate105 文档编号:493883 上传时间:2018-11-28 格式:DOC 页数:4 大小:131.50KB
下载 相关 举报
[计算机类试卷]VB机试模拟试卷92及答案与解析.doc_第1页
第1页 / 共4页
[计算机类试卷]VB机试模拟试卷92及答案与解析.doc_第2页
第2页 / 共4页
[计算机类试卷]VB机试模拟试卷92及答案与解析.doc_第3页
第3页 / 共4页
[计算机类试卷]VB机试模拟试卷92及答案与解析.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、VB机试模拟试卷 92及答案与解析 一、基本操作题( 30分) 1 请根据以下各小题的要求设计 Visual Basic应用程序 (包括界面和代码 )。 (1)在Forml的窗体上建立一个主菜单,标题为 “命令 ”,名称为 Com,该菜单有 3个子菜单,其标题分别为 “输出 ”、 “删除 ”和 “关闭 ”,其名称分别为 Prin、 Del和 Close。编写适当的事件过程,程序运行后,如果单击 “命令 ”菜单中的 “输出 ”命令,则在窗体上显示 “Hello World!”;如果单击 “删除 ”命令,则删除窗体上显示的内容, “关闭 ”命令为关闭对话框。程 序的运行情况如图 371所示。 注意

2、存盘时必须存放在考生文件夹下,工程文件名为 sjl vbp,窗体文件名为 sjl frm。 (2)在 Form1的窗体上画一个标签,其名称为 Labell;再画一个列表框,其名称为 Listl,通过属性窗口向列表框中添加若干个项目,每个项目的具体内容不限,编写适当的事件过程。程序运行后,如果双击列表框中的任意一项,则把列表中的项目序号数和项目文本在标签中显示出来。程序中不准使用任何变量,运行情况如图 372所示。注意:存盘时必须存放在考生文件夹下,工程文件名为 sj2 vbp, 窗体文件名为sj2 frm。 二、简单应用题( 40分) 2 (1)考生文件夹下有一个工程文件 sj3 vbp。程

3、序的功能是:通过键盘向文本框中输入数字,如果输入的是非数字字符,则提示输入错误,且文本框中不显示输入的字符。单击名称为 Commandl、标题为 “添加 ”的命令按钮,则将文本框中的数字添加到名称为 Comb01的组合框中。在给出的窗体文件中已经添加了全部控件,但程序不完整。要求去掉程序中的注释符 (即 “”),把程序中的 “?”改为正确的内容。 注意:不能修改程序中的其他部分和其他控件的属性。 最后把修改后的文件按原文件名存盘。 (2)在考生目录下有一个工程文件 sj4 vbp。该程序的功能是计算M!+(M+1)!+(M+2)!+N! 之和。窗体上有名称分别为 Textl、 Text2的两个

4、文本框,用于接收输入的 M和 N(要求 M57 Or KeyAscii 按钮运行程序,并按要求保存。 (2)本题主要考查标签的 Caption属性, Val()函数和 For循环语句。根据题意,编写如下代码: Private Sub Commandl_Click() Dim m As Integer Dim n As Integer Dim S As Long Dim i As Integer Dim t As Integer m=Val(Textl Text) n=Val(Text2 Text) s=0 For i=m To n t=f(i) s=s+t Next i lblResult C

5、aption=s End Sub Private Function f(ByRef x As Integer)As Long Dim t As Long t=1 For i=1 To x t=t*i Next i f=t End Function 单击 按钮运行程序,并按要求保存。 三、综合应用题( 30分) 3 【正确答案】 文本框显示的内容通过 Text属 性设置;按钮的标题通过 Caption属性设置,单击命令按钮触发 Click事件。本题涉及到文件的操作,读入顺序文件以顺序的方式打开,用 ”Input#”语句读取数据。另外需要注意的是,对文件操作结束后,一定要关闭文件。 建立界面并设置

6、控件属性。程序中用到的控件及其属性如下表所示: 打开工程资源管理器,在其空白处右键添加模块 prog bas(此文件已在考生文件夹里 ),模块代码如下: Option ExplicitSub putdata(ByVal a As Long)Dim sFile As StringsFile=“ resuh txt“Open App Path&sFile For Output As#1Print#1, a;Close#1End Sub 打开工程资源管理器,右击窗体,选择查看代码项,在弹出的代码窗口输入代码如下: Dim i(1 To 100)As IntegerPrivate Sub Cmdl Click()Dim j As Integerj=0Open App Path&“ in txt“For Input As#1For i=1 To 100Input#1, i(j)Next jClose#1For i=i To 100Textl Text=Textl Text&i(j)&Space(5)Next jEnd SubPrivate Sub Cmd2 Click() Dim sum AS LongDim j As Integersum=0Textl Text=“For j=1 To 100If i(j)=400 And i(j)

展开阅读全文
相关资源
猜你喜欢
  • BS PD IEC TS 62763-2013_5284 Pilot function through a control pilot circuit using PWM (pulse width modulation) and a control pilot wire《通过控制导向线使用PWM (脉冲宽度调制) 的导向功能和控制导向线》.pdf BS PD IEC TS 62763-2013_5284 Pilot function through a control pilot circuit using PWM (pulse width modulation) and a control pilot wire《通过控制导向线使用PWM (脉冲宽度调制) 的导向功能和控制导向线》.pdf
  • BS ISO 8070-2007 Milk and milk products - Determination of calcium sodium potassium and magnesium contents - Atomic absorption spectrometric method《牛奶和奶制品 钙、钠、钾和镁含量的测定 原子吸.pdf BS ISO 8070-2007 Milk and milk products - Determination of calcium sodium potassium and magnesium contents - Atomic absorption spectrometric method《牛奶和奶制品 钙、钠、钾和镁含量的测定 原子吸.pdf
  • BS ISO 8082-1-2009 Self-propelled machinery for forestry - Laboratory tests and performance requirements for roll-over protective structures - General machines《林业用自推进机械 防倾.pdf BS ISO 8082-1-2009 Self-propelled machinery for forestry - Laboratory tests and performance requirements for roll-over protective structures - General machines《林业用自推进机械 防倾.pdf
  • BS ISO 8082-2-2011 Self-propelled machinery for forestry Laboratory tests and performance requirements for roll-over protective structures Machines having a rotating platf.pdf BS ISO 8082-2-2011 Self-propelled machinery for forestry Laboratory tests and performance requirements for roll-over protective structures Machines having a rotating platf.pdf
  • BS ISO 8083-2006 Machinery for forestry - Falling-object protective structures (FOPS) - Laboratory tests and performance requirements《林业机械 落体防护装置(FOPS) 实验室试验和性能要求》.pdf BS ISO 8083-2006 Machinery for forestry - Falling-object protective structures (FOPS) - Laboratory tests and performance requirements《林业机械 落体防护装置(FOPS) 实验室试验和性能要求》.pdf
  • BS ISO 8086-2004 Dairy plant - Hygiene conditions - General guidance on inspection and sampling procedures《乳品厂 卫生条件 检验和取样程序通用指南》.pdf BS ISO 8086-2004 Dairy plant - Hygiene conditions - General guidance on inspection and sampling procedures《乳品厂 卫生条件 检验和取样程序通用指南》.pdf
  • BS ISO 8096-2005 Rubber- or plastics-coated fabrics for water resistant clothing - Specification《雨衣用橡胶或塑料涂覆织物 规范》.pdf BS ISO 8096-2005 Rubber- or plastics-coated fabrics for water resistant clothing - Specification《雨衣用橡胶或塑料涂覆织物 规范》.pdf
  • BS ISO 8097-2001 Aircraft Minimum airworthiness requirements and test conditions for certified air cargo unit load devices《航空器 经认证的航空货运集装单元装置最低适航性要求和试验条件》.pdf BS ISO 8097-2001 Aircraft Minimum airworthiness requirements and test conditions for certified air cargo unit load devices《航空器 经认证的航空货运集装单元装置最低适航性要求和试验条件》.pdf
  • BS ISO 8114-1993 Textile machinery and accessories - Spindles for ring-spinning and doubling machines - List of equivalent terms《纺织机械和附件 环锭纺纱机和并线机用锭子 同义术语表》.pdf BS ISO 8114-1993 Textile machinery and accessories - Spindles for ring-spinning and doubling machines - List of equivalent terms《纺织机械和附件 环锭纺纱机和并线机用锭子 同义术语表》.pdf
  • 相关搜索

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

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