计算机系统基础(一):程序的表示、转换与链接(第六周小测验)

2年前 (2022) 程序员胖胖胖虎阿
315 0 0

1.某C语言程序中对数组变量b的声明为“int b[10][5];”,有一条for语句如下:

	for (i=0; i<10, i++)
		for (j=0; j<5; j++)
			sum+= b[i][j];

假设执行到"sum+= b[i][j];"时,sum的值在EAX中,b[i][0]所在的地址在EDX中,j在ESI中,则"sum+= b[i][j];"所对应的指令(AT&T格式)可以是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice1">A.addl 0(%esi, %edx, 2), %eax<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice1">B.addl 0(%esi, %edx, 4), %eax<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice1">C.addl 0(%edx, %esi, 2), %eax<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice1">D.addl 0(%edx, %esi, 4), %eax<br> </div>

2.IA-32中指令"popl %ebp"的功能是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice2">A.R[esp]←R[esp]-4,R[ebp]←M[R[esp]]<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice2">B.R[ebp]←M[R[esp]],R[esp]←R[esp]+4<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice2">C.R[esp]←R[esp]+4,R[ebp]←M[R[esp]]<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice2">D.R[ebp]←M[R[esp]],R[esp]←R[esp]-4<br> </div>

3.IA-32中指令"movl 8(%edx, %esi, 4), %edx"的功能是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice3">A.M[R[edx]+R[esi]*4+8]←R[edx]<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice3">B.M[R[esi]+R[edx]*4+8]←R[edx]<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice3">C.R[edx]←M[R[edx]+R[esi]*4+8]<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice3">D.R[edx]←M[R[esi]+R[edx]*4+8]<br> </div>

4.设SignExt[x]表示对x符号扩展,ZeroExt[x]表示对x零扩展。IA-32中指令"movswl %cx, -20(%ebp)"的功能是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice4">A.M[R[ebp]-20]←SignExt[R[cx]]<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice4">B.R[cx]←SignExt [M[R[ebp]-20]]<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice4">C.M[R[ebp]-20]←ZeroExt[R[cx]]<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice4">D.R[cx]←ZeroExt [M[R[ebp]-20]]<br> </div>

5.假设 R[ax]=FFE8H,R[bx]=7FE6H,执行指令"subw %bx, %ax"后,寄存器的内容和各标志的变化为( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice5">A.R[ax]=8002H,OF=0,SF=1,CF=0,ZF=0 <br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice5">B.R[bx]=8002H,OF=0,SF=1,CF=0,ZF=0<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice5">C.R[ax]=8002H,OF=1,SF=1,CF=0,ZF=0 <br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice5">D.R[bx]=8002H,OF=1,SF=1,CF=0,ZF=0<br> </div>

6.假设R[eax]=0000B160H,R[ebx]=00FF0110H,执行指令"imulw %bx"后,通用寄存器的内容变化为( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice6">A.R[eax]=00007600H,R[dx]=00BCH<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice6">B.R[eax]=FFAC7600H,其余不变<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice6">C.R[eax]=00BC7600,其余不变<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice6">D.R[eax]=00007600H,R[dx]=FFACH<br> </div>

7.假设short型变量x被分配在寄存器AX中,若R[ax]=FF70H,则执行指令"salw $2, %ax"后,变量x的机器数和真值分别是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice7">A.FDC3H,-573<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice7">B.FDC0H,-576<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice7">C.FFDCH,-36<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice7">D.3FDC,16348<br> </div>

8.程序P中有两个变量i和j,被分别分配在寄存器EAX和EDX中,P中语句“if (i<j) { …}”对应的指令序列如下(左边为指令地址,中间为机器代码,右边为汇编指令): 804846a 39 c2 cmpl %eax, %edx 804846c 7e 0d jle xxxxxxxx 若执行到804846a处的cmpl指令时,i=105,j=100,则jle指令执行后将会转到( )处的指令执行。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice8">A.804847b<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice8">B.804846e<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice8">C.8048461<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice8">D.8048479<br> </div>

9.以下关于x87 FPU浮点处理指令系统的叙述中,错误的是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice9">A.float和double型数据从主存装入浮点 寄存器时有可能发生舍入,造成精度损失<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice9">B.提供8个80位浮点寄存器ST(0)~ST(7),采用栈 结构,栈顶为ST(0)<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice9">C.float、double和long double三种类型数据都 按80位格式存放在浮点寄存器中<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice9">D.float、double和long double型数据存入主存 时,分别占32位、64位和96位<br> </div>

10.以下关于MMX/SSE指令集的叙述中,错误的是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice10">A.MMX/SSE指令集和IA-32指令集共用同 一套通用寄存器<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice10">B.同一个微处理器同时支持IA-32指令集与MMX/SSE指令集<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice10">C.SSE指令是一种采用SIMD(单指令多数据)技 术的数据级并行指令<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice10">D.目前SSE支持128位整数运算或同时并行处理两个64位双精度浮点数<br> </div>

相关文章

暂无评论

暂无评论...