留学生考试代考-Computer Systems Organization代写
留学生考试代考

留学生考试代考-Computer Systems Organization代写

CSCI-UA.0201-003

Computer Systems Organization

Midterm Exam Fall 2016 (time: 60 minutes)

留学生考试代考 What will be the final value calculated (in terms of x) after the following expression? (Hint “~” is the bitwise not).

Notes:

  • If you perceive any ambiguity in any of the questions, state your assumptions clearly.
  • Questions vary in difficulty; it is strongly recommended that you do not spend too much time on any one question.

1.(5 points) Circle the correct answer among the choices given. If you circle more than one answer, you will lose the grade of the corresponding question.

(A) The compiler is:

  1. machine dependent
  2. language dependent
  3. both
  4. none

(B) Assume we have the following statement in C: *A = B; . Also assume A is in ebx and B is in ecx. Which of the following is a correct x86 translation to the C statement?

  1. movl %ebx, %ecx 2. movl %ecx, %ebx
  2. movl %ebx,(%ecx)
  3. movl (%ecx), %ebx 5. movl (%ebx), %ecx 6. movl %ecx, (%ebx)

(C) The instruction movq (%rax), %rbx accesses the memory:  留学生考试代考

  1. once
  2. twice
  3. 0 times
  4. depends on whether 32-bit or 64-bit

(D) Which of the following data types is not affected by the byte ordering of the machine (i.e. big endian vs little endian)?

  1. char
  2. int
  3. float
  4. double

(E) Which of the following pointers has a larger size (in terms of bytes)?

  1. pointer in a 32-bit machine 2. pointer in a 64-bit machine
  2. pointer in a 32-bit machine pointing to an array of 100 integers
留学生考试代考
留学生考试代考

2. [2 points] Suppose the variable a is an unsigned int and has a value of x. What will be the final value calculated (in terms of x) after the following expression? (Hint “~” is the bitwise not).Explain your thinking to get full credit.  留学生考试代考

1 + (a << 3) + ˜a

3.[2 points] In all 64-bit machines, a pointer is always 64 bits in length. Why do we need to specify the type of the variable the pointer is pointing to? That is, why don’t we just declare x as a pointer instead of declaring it as pointer to int for example?

4.[2 points] Suppose we have the following decimal number: -15

a) Write that number in an 8-bit binary number. To get full credit, show all the steps.

b) Translate the number you calculated in a) above to hexadecimal.

5.[2 points] Suppose x is an integer. We want to test whether both the most significant and the least significant bits of x are 1 or not (i.e. the right most and left most bits), so we wrote the C expression:

if( …. )

{ tests successful and the two bits are 1 }

else

{ at least one bit of the least significant or most significant is 1}

What will you put between the parenthesizes in order to test that condition?

6.Suppose that we have the following number: 0x4C  留学生考试代考

a) [1 point] Write this number in binary:

b) [2 points] Suppose that this number is interpreted as unsigned number, what is the decimal equivalent (note: you don’t have to write a final decimal number, you can leave it in the format of 2x +2y + …). To get full score, show all the steps.

c) [2 points] Suppose that this number is interpreted as signed number, what is the decimal equivalent (note: you don’t have to write a final decimal number, you can leave it in the format of 2x +2y + …). To get full score, show all the steps.

7. [2 points] Suppose “a” is a pointer to unsigned integer(i.e. it was declared as unsigned int * a; ) and points to the following array of unsigned integers:{3,2,2,1}.

How many times the body of the following loop will be executed? Justify

while( (*a++) & 0x1 ) { …. loop body …. }

 

更多代写:美国程序辅导  托福代考被抓  澳洲金融网课代考  problem solution essay范例  英国硕士论文选题   计量经济学期中代写

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

留学生考试代考
留学生考试代考

发表回复