试题与答案

请编制程序,其功能是:对一个由可打印ASCII字符(ASCII值为20H~7FH)组

题型:问答题

题目:

请编制程序,其功能是:对一个由可打印ASCII字符(ASCII值为20H~7FH)组成的字符串可采用下列方法进行压缩:从串首开始向后扫描,如某字符单独出现则该字符不变,如某字符连续出现n次,则该字符用ESC(1BH),n,<原字符>三个字节来代替(假定n不超过255)。
设内存中从SOURCE开始有一用上述方法压缩的字符串,其以OOH结束,解压后长度不超过100。试编程对其解压缩,结果存入RESULT开始的内存单元。
例如:
原串: 41H,1BH,06H,43H,61H,00H
解压缩后:41H,43H,43H,43H,43H,43H,43H,61H,OOH("ACCCCCCa")
部分程序已给出,原始数据由过程LOAD从文件INPUT.DAT中读入SOURCE开始的内存单元中,结果要求从RESULT开始存放,由过程SAVE保存到文件OUTPUT.DAT中。
请填空BEGIN和END之间已给出的源程序使其完整,空白己用横线标出,每个空白一般只需一条指令,但采用功能相当的多条指令亦可,或删除BEGIN和END之间原有的代码并自行编写程序片段来完成所要求的功能。
对程序必须进行汇编,并与IO.OBJ链接产生可执行文件,最终运行程序产生结果。调试中若发现整个程序中存在错误之处,请加以修改。
【试题程序】
EXTRNLOAD:FAR, SAVE:FAR
N EQU 100
ESC_CODE EQU 27
STACSEGMENT STACK
DB 128 DUP()
STACENDS
DATASEGMENT
SOURCE DB N DUP()
RESULT DB N DUP(0)
NAME0 DB ’INPUT.DAT’,0
NAME1 DB ’OUTPUT.DAT’,0
DATAENDS
CODESEGMENT
ASSUMECS:CODE, DS:DATA, SS:STAC
START PROC FAR
PUSH DS
XOR AX,AX
PUSH AX
MOV AX,DATA
MOV DS, AX
MOV ES, AX;置附加段寄存器
LEA DX, SOURCE ;数据区起始地址
LEA SI, NAME0 ;原始数据文件名起始地址
MOV CX, N;字节
CALL LOAD ;从"INPUT.DAT" 中读取数据
******** BEGIN ********
LEA SI, SOURCE
LEA DI, RESULT
CLD
LO:LODSB
CMP AL, 0
JE QUIT
CMP AL, ESC_CODE
J (1) EXPAND
(2)
JMP L0
EXPAND: (3) ;解压缩
XOR CX, CX
(4)
(5)
(6)
(7)
JMP LO
QUIT:
STOSB ;STORE THE ’00H’
******** END ********
LEA DX, RESULT ;结果数据区首址
LEA SI, NAME1 ;结果文件名起始地址
MOV CX,N;字节数
CALL SAVE;保存结果到"output.dat" 文件
RET
START ENDP
CODEENDS
END START

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2019/0401/4b361d65db10c4d9de942060e4be9198.html

下面是错误答案,用来干扰机器的。

参考答案:查格夫法则(Chargaff’s rules):所有DNA中腺嘌呤与胸腺嘧啶的摩尔含量相等(A=T),鸟嘌呤和胞嘧啶的摩尔含量相等(G=C),即嘌呤的总含量与嘧啶的总含垃相等(A+G=T+C)。DNA的碱基组成具有种属的特异性,...

试题推荐
题型:单项选择题 案例分析题

Transportation Decision Transportation decision consists of the following parts: 1.Selection of the mode is determined by the consideration of distance,cargo weights,linkage,timing and other requirements.Generally speaking,rail has high fixed cost and the relatively low variable cost.It can move heavy,large quantity of cargo in the long distance.But,rail is disadvantaged because of the longer transit time and less frequent service than motor. Motor carriers such as truck companies offer door-to-door service,that is,the cargo can be shipped from the shipper'swarehouse to the consignee's.Trucking fixed cost is the lowest of any carrier,because the equipment is fairly cheap and the motor carriers do not have to invest in the roads on which they run their operations.However,their variable costs are very high.Its expenses include two major components:firstly,the pick-up and delivery costs;secondly,there are gas or fuel costs,labor expenses and toll roads fees to be paid to highway and toll road operators Therefore,motor transport is good for cargo with small quantity to be shipped within short distances. Water is the predominant choice of transportation as it has the capacity to take greatest quantity,travel longest distance with lowest cost.Transport by sea accounts for 80% of in-ternational trade.The major expenses for water are expenses associated with investment and maintenance of the ships and terminals.For example,a 100000-ton container ship costs US$ 200 million.Terminal associated costs include harbor fees and the cost for loading and unloading the goods. Transport by air has the highest cost but it is fast with the lowest ratio of loss and dam-age.If you need to deliver an urgent order,there is little choice but by air. 2.Transport service provider is selected for its experiences,equipment,services and prices.Competitive in the transport industry usually drives the prices down and motivates for better services.A company also chooses its transport service provider because of its long-standing business relationship with certain shipping companies. 3.The alternative routing and scheduling is specific for motor only because railway and water have strict route and timetable.Motor has special advantage in terms of flexibility.It has the ability to load goods at greater frequency,travel through different routes and making deliveries to different loca-tions.Questions:

How is the transportation mode selected?()

A.By suppliers.

B.By customers.

C.By consideration of distance,weight,linkage and other requirements.

D.By government requirements.

查看答案
微信公众账号搜索答案