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

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

1、VB 机试模拟试卷 183及答案与解析 一、基本操作题( 30分) 1 注意:下面出现的 “考生文件夹 ”均为 C: wexam25160002。 请根据以下各小题的要求设计 Visual Basic应用程序 (包括界面和代码 )。 (1) 在名称为 Form1的窗体上画一个文本框,其名称为 Text1,然后通过 “属性 ”窗口设置窗体和文本框的属性,实现如下功能: 在文本框中可以显示多行文本,显示垂直滚动条,显示的初始信息为 “程序设计 ”,显示的字体为三号规则黑体;窗体的标题为 “设置文本框属性 ”。完成设置后的窗体如图 24-1所 示。要求:不编写任何代码。 注意:存盘时必须存放在考生文

2、件夹下,工程文件名为 sjt1.vbp,窗体文件名为 sjt1.frm。 (2) 在名称为Form1的窗体上画两个命令按钮,如图 24-2所示,其名称分别为 Cmd1和 Cmd2,编写适当的事件过程。程序运行后,如果单击命令按钮 Cmd1,则可使该按钮移到窗体的左上角 (只允许通过修改属性的方式实现 );如果单击命令按钮 Cmd2,则可使该按钮在长度和宽度上各扩大到原来的 2倍。程序的运行情况如图 24-3所示。要求:不得使用任何变量。 注意:存盘时必须存放在考生文件夹下, 工程文件名为 sjt2.vbp,窗体文件名为 sjt2.frm。二、简单应用题( 40分) 2 在考生文件夹中有一个工程

3、文件 execise119.vbp,相应的窗体文件为execise119.frm。在名为 Form1的窗体上有一个命令按钮 (名称为 Cmdl,标题为 “求和 ”),其功能是产生 30个 0 1000的随机整数,放入一个数组中,然后输出它们的和。程序运行后,单击命令按钮,即可求出其和,并在窗体上显示出来,如下图所示。 本程序不完整,请补充完整,并能正确运行。 要求: 去掉程序中的注释符 “”,把程序中 的问号 “?”改为正确的内容,使其实现上述功能,但不得修改程序的其他部分。最后,按原文件名并在原文件夹中保存修改后的文件。 三、综合应用题( 30分) 3 在考生文件夹下有一个工程文件 sjt5

4、 vbp和随机文件 in5 txt,文件中的每个记录包括三个字段,分别为姓名、电话和邮编,其名称、类型和长度如下:窗体中有一个文本框和两个命令按钮。程序运行后,如果单击 “读入并显示记录 ”按钮,则从考生文件夹下的 in5 txt文件中读入所有记录并显示在文本框中 (每条记录占一行,数据项的顺序是姓名、电话、邮编,如图 1-160所示,可使用符号常量 vbCrLf表示回车换行 );若单击 “保存 ”按钮则把文本框中的内容存入 out5 txt文件中。要求:编写 “读入并显示记录 ”按钮的 Click过程。把文本框中所有字母改为大写字母 (可手工修改 )。单击 “保存 ”按钮把修改后的文本框内容

5、存盘,否则无成绩 !(过程已给出,不能修改 )。最后以原文件名保存放在考生文件夹下。 VB 机试模拟试卷 183答案与解析 一、基本操作题( 30分) 1 【正确答案】 在窗体上建立好控件后,设置控件的属性。 在 Visual Basic中,文本框的多行显示由 MultiLine属性设置,垂直滚动条由 ScrollBars属性设置,文本框中显示信息由 Text属性设置,字体由 Font属性设置。窗体的标题由 Caption属性设置。解题步骤: 第一步:建立界面并设置控件属性。程序中用到的控件及其属性见表 24-1。 第二步:调试并运行程序。 第三步:按题目要求存盘。 (2)在窗体上建立控件后,

6、先设置控件的属性,再编写事件过程。 单击命令按钮触发 Click事件。利用按钮的 Height和 Width属性,来改变按钮的大小;利用按钮的 Left和 Top属性,来改变按钮的位置。解题步骤: 第一步:建立控件并设置其属性。程序中用到的控件及其属性见表 24-2。第二步:编写程序代码。 参考代码: Option Explicit Private Sub Cmd1_Click() Cmd1.Left=0 Cmd1.Top=0 End Sub Private Sub Cmd2_Click() Cmd2.Height=Cmd2.Height*2 Cmd2.Width=Cmd2.Width*2 E

7、nd Sub 第三步:调试并运行程序。 第四步:按题目要求存盘。 二、简单应用题( 40分) 2 【正确答案】 三、综合应用题( 30分) 3 【正确答案】 【操作步骤】 步骤 1:打开考生文件中的本题工程文件 sjt5 vbp,在代码编辑窗口的指定位置编写以下代码: 参考代码: Open App Path&“ in5 txt“For Random As #1 Len=Len(pal) For i=1 To 5 Get#l, i, pal Textl Text=Textl Text&pal Name Textl Text=Textl Text&pal Tel Textl Text=Textl

8、Text&Str(pal Post) Textl Text=Textl Text+vbCrLf Next Close 1 步骤 2:按要求将文件保存至考生文件夹中。 步骤 3:按 键键运行程序,先单击 “读入记录 ”按钮,然后把文本框中把所有字母改为大写字 母,再单击 “保存记录 ”按钮。 【试题解析】 用 Open 语句打开随机文件,其语法格式为: Open FileName for Random as#FileNumber Len=记录长度。记录长度是一条记录实际所占字节数,可用 Len()函数获取; Get#语句用于从文件中读出某记录号的记录,格式为:Get#FileNumber,RecordNuber, Var Put#语句用于把记录按指定记录号写入文件,格式为: Put撑 FileNumber,RecordNuberVar。 在 “读入并显示记录 ”命 令按钮的 Click 事件过程中,用 Open语句打开考生文件夹下的文件 in5 txt,在 For循环中用 Get语句读入随机文件中相应记录号的记录,赋值给一个声明的记录变量 (如 Pal),并将变量 Pal各元素的值显示在文本框中。为使每条记录各占一行,可在每条记录后面加一个回车换行常数 vbCrLf。

展开阅读全文
相关资源
猜你喜欢
  • BS PD ISO TR 7637-5-2016 Road vehicles Electrical disturbances from conduction and coupling Enhanced definitions and verification methods for harmonization of pulse generators acco.pdf BS PD ISO TR 7637-5-2016 Road vehicles Electrical disturbances from conduction and coupling Enhanced definitions and verification methods for harmonization of pulse generators acco.pdf
  • BS PD ISO TR 80001-2-7-2015 Application of risk management for IT-networks incorporating medical devices Application guidance Guidance for Healthcare Delivery Organizations (HDOs) .pdf BS PD ISO TR 80001-2-7-2015 Application of risk management for IT-networks incorporating medical devices Application guidance Guidance for Healthcare Delivery Organizations (HDOs) .pdf
  • BS PD ISO TS 11999-2-2015 PPE for firefighters Test methods and requirements for PPE used by firefighters who are at risk of exposure to high levels of heat and or flame while figh.pdf BS PD ISO TS 11999-2-2015 PPE for firefighters Test methods and requirements for PPE used by firefighters who are at risk of exposure to high levels of heat and or flame while figh.pdf
  • BS PD ISO TS 13399-71-2016 Cutting tool data representation and exchange Graphical data layout Creation of documents for standardized data exchange Graphical product information《切削.pdf BS PD ISO TS 13399-71-2016 Cutting tool data representation and exchange Graphical data layout Creation of documents for standardized data exchange Graphical product information《切削.pdf
  • BS PD ISO TS 13399-72-2016 Cutting tool data representation and exchange Creation of documents for the standardized data exchange Definition of properties for drawing header and th.pdf BS PD ISO TS 13399-72-2016 Cutting tool data representation and exchange Creation of documents for the standardized data exchange Definition of properties for drawing header and th.pdf
  • BS PD ISO TS 15926-11-2015 Industrial automation systems and integration Integration of life-cycle data for process plants including oil and gas production facilities Methodology f.pdf BS PD ISO TS 15926-11-2015 Industrial automation systems and integration Integration of life-cycle data for process plants including oil and gas production facilities Methodology f.pdf
  • BS PD ISO TS 16550-2014 Nanotechnologies Determination of silver nanoparticles potency by release of muramic acid from $iS$it$ia$ip$ih$iy$il$io$ic$io$ic$ic$iu$is $ia$iu$ir$ie$iu$is.pdf BS PD ISO TS 16550-2014 Nanotechnologies Determination of silver nanoparticles potency by release of muramic acid from $iS$it$ia$ip$ih$iy$il$io$ic$io$ic$ic$iu$is $ia$iu$ir$ie$iu$is.pdf
  • BS PD ISO TS 17822-1-2014 $iI$in $iv$ii$it$ir$io diagnostic test systems Qualitative nucleic acid-based $ii$in $iv$ii$it$ir$io examination procedures for detection and identificati.pdf BS PD ISO TS 17822-1-2014 $iI$in $iv$ii$it$ir$io diagnostic test systems Qualitative nucleic acid-based $ii$in $iv$ii$it$ir$io examination procedures for detection and identificati.pdf
  • BS PD ISO TS 17865-2016 Geometrical product specifications (GPS) Guidelines for the evaluation of coordinate measuring machine (CMM) test uncertainty for CMMs using single and mult.pdf BS PD ISO TS 17865-2016 Geometrical product specifications (GPS) Guidelines for the evaluation of coordinate measuring machine (CMM) test uncertainty for CMMs using single and mult.pdf
  • 相关搜索

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

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