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

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

1.假定全局short型数组a的起始地址为0x804908c,则a[2]的地址是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice1">A.0x8049092<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice1">B.0x8049094<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice1">C.0x8049090<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice1">D.0x804908e<br> </div>

2.假定全局数组a的声明为char *a[8],a的首地址为0x80498c0,i 在ECX中,现要将a[i]取到EAX相应宽度的寄存器中,则所用的汇编指 令是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice2">A.mov (0x80498c0, %ecx, 4), %eax<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice2">B.mov (0x80498c0, %ecx), %ah<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice2">C.mov 0x80498c0( , %ecx), %ah<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice2">D.mov 0x80498c0( , %ecx, 4), %eax<br> </div>

3.假定全局数组a的声明为double *a[8],a的首地址为0x80498c0,i 在ECX中,现要将a[i]取到EAX相应宽度的寄存器中,则所用的汇编 指令是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice3">A.mov 0x80498c0( , %ecx, 4), %eax 0.50/0.50<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice3">B.mov (0x80498c0, %ecx, 8), %eax<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice3">C.mov (0x80498c0, %ecx, 4), %eax<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice3">D.mov 0x80498c0( , %ecx, 8), %eax<br> </div>

4.假定局部数组a的声明为int a[4]={0, -1, 300, 20},a的首地址为R[ebp]-16,则将a的首地址取到EDX的汇编指令是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice4">A.leal -16(%ebp), %edx<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice4">B.leal -16(%ebp, 4), %edx<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice4">C.movl -16(%ebp, 4), %edx<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice4">D.movl -16(%ebp ), %edx<br> </div>

5.某C语言程序中有以下两个变量声明:

	int  a[10];
	int  *ptr=&a[0];

则ptr+i的值为( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice5">A.&a[0]+4<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice5">B.&a[0]+8<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice5">C.&a[0]+2<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice5">D.&a[0]+i<br> </div>

6.假定静态short型二维数组b的声明如下:

static short b[2][4]={ {2, 9, -1, 5}, {3, 8, 2, -6}};

若b的首地址为0x8049820,则按行优先存储方式下,数组元素"8"的地址是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice6">A.0x804982a<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice6">B.0x8049825 <br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice6">C.0x8049824<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice6">D.0x8049828<br> </div>

7.假定静态short型二维数组b和指针数组pb的声明如下:

static short b[2][4]={ {2, 9, -1, 5}, {3, 1, -6, 2 }};
static short *pb[2]={b[0], b[1]};

若b的首地址为0x8049820,则pb[1]的值是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice7">A.0x8049820<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice7">B.0x8049824<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice7">C.0x8049822<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice7">D.0x8049828<br> </div>

8.假定静态short型二维数组b和指针数组pb的声明如下:

static short b[2][4]={ {2, 9, -1, 5}, {3, 1, -6, 2 }};
static short *pb[2]={b[0], b[1]};

若b的首地址为0x8049820,则&pb[1]的值是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice8">A.0x8049834<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice8">B.0x8049832<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice8">C.0x8049830<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice8">D.0x8049838<br> </div>

9.假定结构体类型cont_info的声明如下:

struct cont_info {
	char id[8];
	char name [16];
	unsigned post;
	char address[100];
	char phone[20];
} ;

若结构体变量x初始化定义为struct cont_info x={"00000010", "ZhangS", 210022, "273 long street, High Building #3015", "12345678"},x的首地址在EDX中,则"unsigned xpost=x.post;"对应汇编指令为( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice9">A.leal 0x24(%edx), %eax<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice9">B.movl 0x24(%edx), %eax<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice9">C.movl 0x18(%edx), %eax<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice9">D.leal 0x18(%edx), %eax<br> </div>

10.以下是关于IA-32处理器对齐方式的叙述,其中错误的是( )。

<div> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled checked type="radio" name="choice10">A.总是按其数据宽度进行对齐,例如,double型变量的地址总是8的倍数<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice10">B.不同操作系统采用的对齐策略可能不同<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice10">C.对于同一个struct型变量,在不同对齐方式下可能会占用不同大小的存储区<br> &nbsp;&nbsp;&nbsp;&nbsp;<input disabled type="radio" name="choice10">D.可以用编译指导语句(如#pragma pack)设置对齐方式<br> </div>

相关文章

暂无评论

暂无评论...