[计算机类试卷]PC技术机试模拟试卷55及答案与解析.doc

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

1、PC技术机试模拟试卷 55及答案与解析 一、程序设计题 1 编制一个程序,其功能为:内存中以 8位无符号数形式连续存放着 10个数据,这数据来自于一个自动抄表系统记录的 10个用户某月天然气的使用量 (立方米 ),天然气费计算公式如下 (其中, X表示天然气用量, Y表示应交天然气费 ): a)Y X80 X6 b)Y X120 6 X10 c)Y X160 X 10 计算每个用户需要交的天然气费,结果用字表示,并将结果存入指定单元。 例如: 用天然气量: 05H, 07H, 12H 天然气费: 0190H, 0348H, 0780H 部分程序已经给出,其中原始数据由过程 LOAD从文件 IN

2、PUT.DAT中读入以SOURCE开始的内存单元中。运算结果要求从 RESULT开始的内存单元存放, 由过程 SAVE保存到文件 OUTPUT.DAT中。 请填空 BEGIN和 END之间已给出的源程序使其完整,空白已经用横线标出,每行空白一般只需要一条指令,但采用功能相当的多条指令亦可,考生也可以删除BEGIN和 END之间原有的代码并自行编程来完成要求的功能。 对程序必须进行汇编,并与 IO.OBJ链接产生执行文件,最终运行程序产生结果。调试中若发现整个程序中存在错误之处,请加以修改。 试题程序 EXTRN LOAD: FAR, SAVE: FAR N EQU 10 DSEG SEGMEN

3、T SOURCE DB N DUP(?) RESULT DW N DUP(0) A DB 80 B DB 120 C DB 160 NAME0 DB INPUT DAT, 0 NAME1 DB OUTPUT DAT, 0 DSEG ENDS SSEG SECMENT STACK DB 256 DUP(?) SSEG ENDS CSEG SEGMENT ASSUME CS: CSEG, DS: DSEG, SS: SSEG START PROC FAR PUSH DS XOR AX, AX PUSH AX MOV AX, DSEG MOV DS, AX LEA DX, SOURCE LEA SI

4、 NAME0 MOV CX, N CALL LOAD ; * BEGIN * LEA SI, SOURCE LEA DI, RESULT CLD MOV CX, N AGAIN: MOV AL, SI CMP AL, 6 JA (1) (2) JMP NEXT LIMIT6: CMP AL, 10 JA (3) (4) JMP NEXT LIMIT10: (5) NEXT: MOV DI, AX INC SI ADD DI, 2 LOOP AGAIN ; * END * LEA DX, RESULT LEA SI, NAME1 MOV CX, N*2 CALL SAVE RET START

5、ENDP CSEG ENDS END START PC技术机试模拟试卷 55答案与解析 一、程序设计题 1 【正确答案】 (1)LIMIT6 (2)MUL A (3)LMIT10 (4)MUL B (5)MUL C 【试题解 析】 本题一个分段函数的问题,根据数据大小的不同,再采用不同的计算方法求出结果。其中所需要的一些常量在数据段中已经进行了定义,在程序中直接使用即可。但由于对每个数据进行处理的算法是相同的,因此用一个循环即可实现对所有数据的处理。另外,由于要分成不同的情况进行计算,所以循环中采用的是分支程序来实现。 进入循环以后,将数据取入 AL中,并将其与 6进行比较,如果大于 6的话就

6、需要进行跳转,否则将执行下面的操作。由于小于 6时天然气费计算的方法是乘以80,因此第二个空白处应该填的内容是 MUL A。第一个空白处应填 跳转到哪条语句继续执行,有两个选择 LMIT6或 LIMIT10,但由于当数据大于 6的时候,还有一个上限 10需要比较,因此跳转的方向应该是和 10进行比较的语句,从程序中可以知道应该是 LIMIT6。第三个和第四个空白是数据和 10进行比较后所需要的处理,大于 10的时候跳转,小于 10的时候继续执行。前面已经与 6进行过比较,大于 6的数才执行到这里,而数据又小于 10,因此此时的天然气费计算方法是乘以 120,即第四个空白处应填 MUlB。由于大于 10的时候天然气费的计算方法为乘以 160,因此最后一个空白处的语句是 MUL C。

展开阅读全文
相关资源
猜你喜欢
  • ASD-STAN PREN 4033-1996 Aerospace Series Bearings Airframe Rolling Rigid Single Row Ball Bearings in Corrosion Resisting Steel Diameter Series 8 and 9 Reduced Internal Radial Clear.pdf ASD-STAN PREN 4033-1996 Aerospace Series Bearings Airframe Rolling Rigid Single Row Ball Bearings in Corrosion Resisting Steel Diameter Series 8 and 9 Reduced Internal Radial Clear.pdf
  • ASD-STAN PREN 4034-1996 Aerospace Series Bearings Airframe Rolling Double Row Self- Aligning Ball Bearings with Flanged Outer Ring in Corrosion Resisting Steel Reduced Internal Rad.pdf ASD-STAN PREN 4034-1996 Aerospace Series Bearings Airframe Rolling Double Row Self- Aligning Ball Bearings with Flanged Outer Ring in Corrosion Resisting Steel Reduced Internal Rad.pdf
  • ASD-STAN PREN 4035-1996 Aerospace Series Rod Ends Adjustable with Self-Aligning Double Row Ball Bearing in Corrosion Resisting Steel Reduced Internal Radial Clearance and Threaded .pdf ASD-STAN PREN 4035-1996 Aerospace Series Rod Ends Adjustable with Self-Aligning Double Row Ball Bearing in Corrosion Resisting Steel Reduced Internal Radial Clearance and Threaded .pdf
  • ASD-STAN PREN 4036-1996 Areospace Series Rod Ends Adjustble with Self-Aligning Double Row Ball Bearing and Threaded Shank in Corrosion Resisting Steel Reduced Internal Radial Clear.pdf ASD-STAN PREN 4036-1996 Areospace Series Rod Ends Adjustble with Self-Aligning Double Row Ball Bearing and Threaded Shank in Corrosion Resisting Steel Reduced Internal Radial Clear.pdf
  • ASD-STAN PREN 4037-1996 Aerospace Series Bearings Spherical Plain in Corrosion Resisting Steel with Self-Lubricating Liner Reduced Starting Torque Light Series Dimensions and Loads.pdf ASD-STAN PREN 4037-1996 Aerospace Series Bearings Spherical Plain in Corrosion Resisting Steel with Self-Lubricating Liner Reduced Starting Torque Light Series Dimensions and Loads.pdf
  • ASD-STAN PREN 4038-1996 Aerospace Series Bearings Spherical Plain in Corrosion Resisting Steel with Self-Lubricating Liner Reduced Starting Torque Normal Narrow Series Dimensions a.pdf ASD-STAN PREN 4038-1996 Aerospace Series Bearings Spherical Plain in Corrosion Resisting Steel with Self-Lubricating Liner Reduced Starting Torque Normal Narrow Series Dimensions a.pdf
  • ASD-STAN PREN 4039-1996 Aerospace Series Bearings Spherical Plain in Corrosion Resisting Steel with Self-Lubricating Liner Reduced Starting Torque Normal Wide Series Dimensions and.pdf ASD-STAN PREN 4039-1996 Aerospace Series Bearings Spherical Plain in Corrosion Resisting Steel with Self-Lubricating Liner Reduced Starting Torque Normal Wide Series Dimensions and.pdf
  • ASD-STAN PREN 4040-1996 Aerospace Series Bearings Spherical Plain in Corrosion Resisting Steel with Self-Lubricating Liner with Wide Inner Ring Elevated Loads at Ambient Temperatur.pdf ASD-STAN PREN 4040-1996 Aerospace Series Bearings Spherical Plain in Corrosion Resisting Steel with Self-Lubricating Liner with Wide Inner Ring Elevated Loads at Ambient Temperatur.pdf
  • ASD-STAN PREN 4041-1997 Aerospace Series Bearings Airframe Rolling Rigid Single Row Ball Bearings in Corrosion Resisting Steel with Extended Inner Ring and Flanged Alignment Bush D.pdf ASD-STAN PREN 4041-1997 Aerospace Series Bearings Airframe Rolling Rigid Single Row Ball Bearings in Corrosion Resisting Steel with Extended Inner Ring and Flanged Alignment Bush D.pdf
  • 相关搜索

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

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