=========================preview======================
(COMP180)[2009](s)final~cs_ktk^_10172.pdf
Back to COMP180 Login to download
======================================================
Student ID:
HONG KONG UNIVERSITY OF SCIENCE & TECHNOLOGY

Computer Organization (COMP 180)
Spring Semester, 2009


Final Examination
May 29, 2009
Name: Student ID:
Email: Lab Section Number:
Instructions:
1.
This examination paper consists of 17 pages, with 8 questions and 4 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 2 hours and 45 minutes.

8.
Stop writing immediately when the time is up.


Question Percentage % Scores
1 10
2 10
3 20
4 5
5 15
6 20
7 10
8 10
TOTAL 100

Student ID:
Question 1, Basics (10marks)
For each of the following statements, write down T, if you think it is true, and F, otherwise.
(Note: 0.5 marks will be deducted for each wrong answer)
1) Pipelining always decreases the latency of a single instruction.

Ans:F
2) If the signs of the divisor and dividend are different, then the quotient should be negated.
Ans:T 3) The data is transferred in block for the memory to the cache because of the principle of temporal locality. Ans:F 4) Flip-flops are the basic building blocks for combinational logic circuits. Ans:F 5) MIPS instructions for operations on double-precision floating-point numbers are 64 bits in length. Ans:F 6) Direct mapped block placement is a special case of N-way set associative schemes. Ans:T 7) In the IEEE 754 double precision representation, the value of the exponent bias is 127. Ans:F 8) In the LRU scheme, the block replaced is the one that has been unused for the longest time. Ans:T 9) In a multi-cycle datapath implementation of MIPS, the instruction register needs to hold an instruction only between two adjacent clock cycles Ans:F 10) When two twos complement numbers are added, having a carry out from the most significant bit indicates an overflow. Ans:F
Page 2 of 17
Student ID:
Question 2, Basic MIPS Programming (10 marks)
The object of this problem is to convert the following c++ program, which returns the sum of an array, into a MIPS program. You are given the MIPS program skeleton below and you must fill in the blank lines with the missing instructions. Each line holds one instruction only.
#include <iostream>
using namespace std ;
int sum (int[], int) ;
void main () {
int size= 10 ;
int A[]={1,2,3,4,5,6,7,8,9,10} ;
cout << sum ( A, size ) ;
}
int sum(int a[], int s) {
int k = 0 ;
for (int i =0 ; i < s ; i++)
k= k + a[i] ;
return k ;
}