The computer system basis (a): representation of the program, and the conversion link (eighth week quiz)

1. Assume the global short arrays of a start address 0x804908c, then a [2] of the address is ().

     A.0x8049092
     B.0x8049094
     C.0x8049090
     D.0x804908e

Statement 2. Suppose a global array of char * a [8], a first address 0x80498c0, i in the ECX, now want a [i] corresponding to the width of the take EAX register, the assembler instruction is used ().

     A.mov (0x80498c0, %ecx, 4), %eax
     B.mov (0x80498c0,% ecx),% ah
     C.mov 0x80498c0 (,% ecx),% ah
     D.mov 0x80498c0( , %ecx, 4), %eax

3. Statement assume a global array of double * a [8], a first address 0x80498c0, i in the ECX, now want a [i] corresponding to the width of the take EAX register, the assembler instruction is used ().

     A.mov 0x80498c0( , %ecx, 4), %eax 0.50/0.50
     B.mov (0x80498c0, %ecx, 8), %eax
     C.mov (0x80498c0, %ecx, 4), %eax
     D.mov 0x80498c0( , %ecx, 8), %eax

4. assumed to declare a local array int a [4] = {0, -1, 300, 20}, a first address R [ebp] -16, then taken to a first address EDX assembly instructions Yes( ).

     A.leal -16(%ebp), %edx
     B.leal -16(%ebp, 4), %edx
     C.movl -16(%ebp, 4), %edx
     D.movl -16(%ebp ), %edx

5. a C language program has the following two variable declarations:

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

Ptr + i is the value ().

     A.&a[0]+4
     B.&a[0]+8
     C.&a[0]+2
     D.&a[0]+i

6. The statement assumes static short-type two-dimensional array b is as follows:

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

If b is the first address 0x8049820, at press row-major storage array element "8" address is ().

     A.0x804982a
     B.0x8049825
     C.0x8049824
     D.0x8049828

7. assumed declares a static two-dimensional array of short pointer array b and pb are as follows:

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

If b is the first address 0x8049820, the pb [1] is the value of ().

     A.0x8049820
     B.0x8049824
     C.0x8049822
     D.0x8049828

8. assumed declares a static two-dimensional array of short pointer array b and pb are as follows:

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

If b is the first address 0x8049820, the & pb [1] is the value of ().

     A.0x8049834
     B.0x8049832
     C.0x8049830
     D.0x8049838

9. The structure type declaration cont_info assumed as follows:

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

If the structure of the variable x is initialized defined struct cont_info x = { "00000010", "ZhangS", 210022, "273 long street, High Building # 3015", "12345678"}, the first address x in EDX, then "unsigned xpost = x.post; "assembly instructions corresponding to ().

     A.leal 0x24(%edx), %eax
     B.movl 0x24(%edx), %eax
     C.movl 0x18(%edx), %eax
     D.leal 0x18(%edx), %eax

10. The following is an account of the alignment of IA-32 processors, wherein the error is ().

     A. always align its data width, e.g., the address of the variable double type is always a multiple of 8
     B. alignment strategies using different operating systems may be different
     C. For the same struct variable, at different alignment may occupy memory areas of different sizes
     D. You can set the alignment with guide compiled statements (such as #pragma pack)

Guess you like

Origin www.cnblogs.com/nonlinearthink/p/11809630.html