[SOLVED] CS代考 CSCI-UA.0201-003

30 $

File Name: CS代考_CSCI-UA.0201-003.zip
File Size: 235.5 KB

SKU: 6795314902 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


CSCI-UA.0201-003
Computer Systems Organization
Midterm Exam Fall 2015 (time: 60 minutes) Last name: First name:
 If you perceive any ambiguity in any of the questions, state your assumptions clearly.

Copyright By PowCoder代写加微信 assignmentchef

 Questions vary in difficulty; it is strongly recommended that you do not spend too much time
on any one question.
1. [2 points] What would have happened if we didn’t have linkers? State 2 consequences.
2. [5 points] Fill in the blanks in the following table, assume the instructions are executed sequentially (i.e. instruction 1 executed, then instruction 2, then instruction 3. Assume rax and rbx are holding signed numbers.
instruction# instruction Initially
1 addq %rbx, %rax
2 testq %rbx, %rax
3 cmpq %rbx, %rax
0xFFFFFFFF 0x00000001
CF ZF SF OF

3. [5 points] For the following assembly code and its corresponding C code, fill-in the blanks in the C code assuming x will go into %rbx and y will go into %rax;
cmpq %rax, %rbx ja L1
subq, %rbx, %rax jmp L2
L1: addq $10, %rax
L2: addq %rbx, %rax
____________ x, y; /* declaration of x and y; if ( _________________ )
____________________________
_____________________________
__________________________
4. [2 points] Can the carry flag (CF) and the overflow flag (OF) be both 1 at the same time? If yes, give an example of an operation that does this (no need for assembly code, just describe the operation). If not, explain why not.
5. [2 points] State two reasons for why do we need an assembler and not making the compiler generate the binary presentation right away.

6. Suppose x is an integer (i.e. 4 bytes). We want to test whether the most significant bit of x is 1 or not (i.e. the left most bit), so we wrote the expression:
if( (x & mask) != 0)
a. [1 point] What is the value of mask, both in binary and hexadecimal?
b. [2 points] Which of the following expressions generate correct mask? Circle ALL correct answers. There may be more than one correct answer, or there may be none!
 0x1FFFFFFF << 3 0x1FFFFFFF << 2 two’s complement of 0xFFFFFFFC two’s complement of (-2)c. [1 point] Please give the expression that sets the most significant bit of x to 1 and leave all the other bits unchanged.程序代写 CS代考加微信: assignmentchef QQ: 1823890830 Email: [email protected]

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS代考 CSCI-UA.0201-003
30 $