计算机系统组织代考-Midterm Exam代写
计算机系统组织代考

计算机系统组织代考-Midterm Exam代写

CSCI-UA.0201-003

Computer Systems Organization

Midterm Exam – Fall 2014

(60 minutes)

计算机系统组织代考 Circle the correct answer among the choices given. If you circle more than one answer, you will lose the grade of the corresponding  question.

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.
  • This exam is open book/notes.

1.(4 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) Registers usage convention is needed to:

  1. make our programs correct
  2. make our programs faster
  3. make our programs work with other programs and library
  4. make our programs more memory efficient

(B) Presenting +17 in signed integer or in IEEE 754 single precision floating point yields the same bit pattern.    计算机系统组织代考

  1. The above statement is true
  2. The above statement is false
  3. It depends on whether the machine is 32-bit or 64-bit
  4. It depends on whether the machine is big-endian or little endian.

(C) Which of the following has a larger size (in terms of bytes), assuming 32-bit machine?

  1. pointer to a character
  2. pointer to an integer
  3. pointer to a float
  4. pointer to pointer
  5. They are all of the same size.

(D) Assume a function is called from two different places in a C program running on a 32-bit x86 machine:

  1. The stack frame of that function is of the same size each time.
  2. The stack frame size of that function differs based on the arguments.
计算机系统组织代考
计算机系统组织代考

2.Given the following structure definition (assume 32-bit machine):  计算机系统组织代考

struct {

char c;   double *p;    int i;

double d;    short s;    } mystruct;

We said in class that a data item of size x must be stored in memory in an address multiple of x. We called this alignment.

a) (3 points) Fill out the following memory snapshot, showing how the structure items are placed in memory, including padding (if any). You start from address 0 (far left of the figure). You must show at which address every item starts and ends,where are the padding (if any), and the total number of bytes taken by the whole structure.

计算机系统组织代考
计算机系统组织代考

b) (3 points) Can we re-order the items of the structure to take less space? If yes,fill the figure below showing the new order and the total space taken by the structure. If not, explain why.

3. (4 points) State two scenarios where (some) local variables of a function must be in the stack and not in registers?

Scenario 1:

Scenario 2:

4.For the following two functions (assume n >= 0):  计算机系统组织代考

(a) (2 points) What does the function fact do?

(b) (2 points) For which values of n do fact and fact_u2 produce similar results?

(c) (2 points) What is the minimum modification that we can do to fact_u2 such that it always produces same result as fact?

 

更多代写:澳洲留学生经济代考  雅思线上代考  北美Finance代写  代写Reflection essay范文  法律学论文代写  代考计量经济学final

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

计算机系统组织代考
计算机系统组织代考

发表回复