【计算机类职业资格】二级VISUAL+BASIC机试-72及答案解析.doc

上传人:roleaisle130 文档编号:1327600 上传时间:2019-10-17 格式:DOC 页数:3 大小:31KB
下载 相关 举报
【计算机类职业资格】二级VISUAL+BASIC机试-72及答案解析.doc_第1页
第1页 / 共3页
【计算机类职业资格】二级VISUAL+BASIC机试-72及答案解析.doc_第2页
第2页 / 共3页
【计算机类职业资格】二级VISUAL+BASIC机试-72及答案解析.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、二级 VISUAL+BASIC 机试-72 及答案解析(总分:100.00,做题时间:90 分钟)1.在窗体上创建三个命令按钮,名称分别为 Command1、Command2 和 Command3,标题分别为“导入数据”、“字母转换”和“保存数据”,以及一个文本框,名称为 Text1。编写事件过程,使得在运行时,单击“导入数据”按钮,从考生文件里读入 data.txt 文件(字母&空格),在 Text1 中显示。单击“字母转换”按钮,则把 Text1 中的所有大写字母转换成小写字母。单击“保存数据”按钮,存入 out.txt 文件中。程序运行后如图 28 所示。要求实现题目给出的功能,并将文件

2、保存在考生文件夹下,工程文件名为ylc.vbp。(分数:100.00)_二级 VISUAL+BASIC 机试-72 答案解析(总分:100.00,做题时间:90 分钟)1.在窗体上创建三个命令按钮,名称分别为 Command1、Command2 和 Command3,标题分别为“导入数据”、“字母转换”和“保存数据”,以及一个文本框,名称为 Text1。编写事件过程,使得在运行时,单击“导入数据”按钮,从考生文件里读入 data.txt 文件(字母&空格),在 Text1 中显示。单击“字母转换”按钮,则把 Text1 中的所有大写字母转换成小写字母。单击“保存数据”按钮,存入 out.txt

3、 文件中。程序运行后如图 28 所示。要求实现题目给出的功能,并将文件保存在考生文件夹下,工程文件名为ylc.vbp。(分数:100.00)_正确答案:(1)Visual Basic 集成环境中,执行“文件”“新建工程”命令,选择“标准 Exe”。创建窗体 Form1。2)在工具箱中选择文本框控件,在窗体建立一个文本框 Text1,将其 Text 属性设为空。(3)在工具箱中选择命令按钮控件在窗体上创建三个命令按钮,名称分别为 Command1、 Command2 和Command3,标题分别为“导入数据”、“字母转换”和“保存数据”。(4)双击“导入数据”按钮,弹出代码窗口,在其中添加如下代

4、码:Private Sub Command1_Click()Dim a As StringCall FindData(a)Text1.Text=aEnd SubSub FindData(a As String)Open App. Path & “/“ & “data.txt“ For Input As #1Do While Not EOF(1)Input #1,aLoopClose #1End Sub(5)双击“字母转换”按钮弹出代码窗口,在其中添加如下代码:Private Sub Command2_Click()Text1.Text=UCase(Text1.Text)End Sub(6)双击

5、保存数据”按钮弹出代码窗口,在其中添加如下代码:Private Sub Command3_Click()Call SaveData(Text1.Text)End SubSub SaveData(a As String)Open App.Path & “/“ & “out. txt“ For Output As #1Print #1, aClose #1End Sub(7)按 F5 键运行程序。如图 28 所示。(8)执行“文件”“保存工程”命令,将工程文件命名为 ylc.vbp,窗体文件命名为 ylc.frm。)解析:解析 (1)该题综合考查了多个知识点,重点考查了文件的读入操作并在文本框中输出;字符串转换函数 UCase(),转换字符串的大小写;对顺序文件的读入和输出的操作等。(2)该题重点考查了命令按钮的单击事件与函数过程的调用,通过调用可以很方便地实现题中要求的各种功能。

展开阅读全文
相关资源
猜你喜欢
  • BS EN ISO 15350-2010 Steel and iron - Determination of total carbon and sulfur content - Infrared absorption method after combustion in an induction furnace (routine method)《钢铁 总碳量.pdf BS EN ISO 15350-2010 Steel and iron - Determination of total carbon and sulfur content - Infrared absorption method after combustion in an induction furnace (routine method)《钢铁 总碳量.pdf
  • BS EN ISO 15351-2010 Steel and iron - Determination of nitrogen content - Thermal conductimetric method after fusion in a current of inert gas (Routine method)《钢铁 氮含量的测定 惰性气体熔融后热电导.pdf BS EN ISO 15351-2010 Steel and iron - Determination of nitrogen content - Thermal conductimetric method after fusion in a current of inert gas (Routine method)《钢铁 氮含量的测定 惰性气体熔融后热电导.pdf
  • BS EN ISO 15367-1-2003 Lasers and laser-related equipment - Test methods for determination of the shape of a laser beam wavefront - Terminology and fundamental aspects《激光和激光相关设备 测定.pdf BS EN ISO 15367-1-2003 Lasers and laser-related equipment - Test methods for determination of the shape of a laser beam wavefront - Terminology and fundamental aspects《激光和激光相关设备 测定.pdf
  • BS EN ISO 15367-2-2006 Lasers and laser-related equipment - Test methods for determination of the shape of a laser beam wavefront - Shack-Hartmann sensors《激光和激光相关设备 激光束波前形状测定试验方法 哈.pdf BS EN ISO 15367-2-2006 Lasers and laser-related equipment - Test methods for determination of the shape of a laser beam wavefront - Shack-Hartmann sensors《激光和激光相关设备 激光束波前形状测定试验方法 哈.pdf
  • BS EN ISO 15378-2015 Primary packaging materials for medicinal products Particular requirements for the application of ISO 9001 2008 with reference to Good Manufacturing Practice (.pdf BS EN ISO 15378-2015 Primary packaging materials for medicinal products Particular requirements for the application of ISO 9001 2008 with reference to Good Manufacturing Practice (.pdf
  • BS EN ISO 15403-1-2008 Natural gas - Natural gas for use as a compressed fuel for vehicles - Designation of the quality《天然气 用作车辆压缩燃料的天然气 质量标识》.pdf BS EN ISO 15403-1-2008 Natural gas - Natural gas for use as a compressed fuel for vehicles - Designation of the quality《天然气 用作车辆压缩燃料的天然气 质量标识》.pdf
  • BS EN ISO 15423-2010 Information technology Automatic identification and data capture techniques Bar code scanner and decoder performance testing《信息技术 自动识别和数据采集技术 条形码扫描器和解码器性能试验》.pdf BS EN ISO 15423-2010 Information technology Automatic identification and data capture techniques Bar code scanner and decoder performance testing《信息技术 自动识别和数据采集技术 条形码扫描器和解码器性能试验》.pdf
  • BS EN ISO 15463-2003 Petroleum and natural gas industries - Field inspection of new casing tubing and plain-end drill pipe《石油和天燃气工业 新套管、管和平端钻管的现场检验》.pdf BS EN ISO 15463-2003 Petroleum and natural gas industries - Field inspection of new casing tubing and plain-end drill pipe《石油和天燃气工业 新套管、管和平端钻管的现场检验》.pdf
  • BS EN ISO 15465-2004 Pipework - Stripwound metal hoses and hose assemblies《管道 带绕金属软管和软管组件》.pdf BS EN ISO 15465-2004 Pipework - Stripwound metal hoses and hose assemblies《管道 带绕金属软管和软管组件》.pdf
  • 相关搜索

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

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