=========================preview======================
(COMP180)midterm2009_sol.pdf
Back to COMP180 Login to download
======================================================
HONG KONG UNIVERSITY OF SCIENCE & TECHNOLOGY
Computer Organization (COMP 180)
Spring Semester, 2009
Midterm Examination 1
Mar 6, 2009


Name: 1 Solution Student ID:

Email: Lab Section Number:


Instructions:

1.
This examination paper consists of 11 pages, with 6 questions and 2 appendix reference pages.


2.
Please write your name, student ID, email and lab section number on this page.


3.
Please answer all the questions in the spaces provided on the examination paper.


4.
Please read each question very carefully, answer clearly and to the point. Make sure that your answers are neatly written.


5.
Keep all pages stapled together.


6.
Calculator and electronic devices are not allowed


7.
The examination period will last for 1 hour and 45 mins.


8.
Stop writing immediately when the time is up.








Question
Percentage %
Scores

1
10


2
20


3
20


4
15


5
15


6
20


TOTAL
100





Question 1 Basics (10 marks)

For each of the following statements, write down T if it is true and F otherwise.
(note: 1 mark will be deducted for each wrong answer)

1)In the addition, X + Y, overflow must not occur if X and Y are of
different signs

Ans: T

2) The ALU is a combinational circuit
Ans:T

3)
The stack used in MIPS programming grows upward from lower memory address



Ans:F

4) The largest twos complement number represented on 16 bits is 216-1
Ans:F

5) The register $ra is unchanged when the instruction jal is executed
Ans: F

6) An n-bit decoder should have n2 output
Ans: F

7) To reserve 1 byte of memory from the stack, the following instruction should be executed: addi $sp, $sp, -4
Ans: F

8) In MIPS, instructions can be either 32 bit long or 64 bit long
Ans: F

9) The instruction, lb $t0, 1000($zero), loads one byte from memory address 1000 and stores it in the least significant byte of register $t0
Ans: T

10) The following three instructions load the first word of the array into register $t3.
la $t1, array
addi $t2, $zero, 0
lw $t3, $t2($t1)

Ans: F







Question 2 Basics Logic Design (20 marks)

Consider a 1-bit full adder with three inputs a, b, and carryIn and two outputs sum and
carryOut.

a) Give a truth table for the adder. The table should have the following five columns: a, b,
carryIn, sum, and carryOut. (8 marks)

a
b
carryIn
sum
carryOut

0
0
0
0
0

0
0
1
1
0

0
1
0
1
0

0
1
1
0
1

1
0
0
1
0

1
0
1
0
1

1
1
0
0
1

1
1
1
1
1



b) Write down two logic equations in sum-of-product representation for the sum bit and the carry