=========================preview======================
(comp180)[2010](s)midterm1~1732^_10173.pdf
Back to COMP180 Login to download
======================================================
Student ID:
HONG KONG UNIVERSITY OF SCIENCE & TECHNOLOGY
Computer Organization (COMP 180)
Spring Semester, 2010
Midterm Examination 1
Mar 6, 2010
Name: Solution Student ID:
Email: Lab Section Number:
Instructions:
1.
This examination paper consists of 9 pages, with 7 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 12
3 22
4 20
5 16
6 10
7 10
TOTAL 100
Student ID:
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) The values stored in any MIPS general purpose register can be modified. Ans: F
2) The address of any byte unit in memory is 32 bit. Ans:T
3) Consider the instruction j L1. The location of L1 should be within 256 MB relative to the address of the current instruction. Ans:T
4) All jump instructions are 32 bit long. Ans:T
5) Having fixed length, with different instruction formats leads to simpler hardware design. Ans:T
6) Registers are some special locations in the main memory allowing faster access. Ans:F
7) The MIPS instruction sw $s0, 12($t0) is an R-type instruction. Ans:F
8) The MIPS instruction bne $s0, $s0, L1 always executes the statement labeled L1 Ans: F
9) In MIPS instruction set, 5 bits are always used to represent opcode Ans: F
10) slti $t0, $t1, 1 beq $t0, $zero, L1 If the value of register $t0 is 1, after the two instructions above are executed, the next instruction to be executed is labeled as L1 Ans: F
Page 2 of 11
Question 2 System Call (12 marks)
Consider the following MIPS program. Fill in the blanks so that the console displays the following message (. being the white space character): Hello.World! Note that only ONE instruction is allowed for each blank line. (2 marks per instruction) MIPS program: #----------Data Segment---------- .data # declare the strings msg1 and msg2
msg1: .asciiz ".World!\n"
msg2: .byte 0x6c # character l
.byte 0x6c # character l
.byte 0 # character \0
.byte 0x6f # character o
.byte 0 # character \0
.byte 0x48 # character H
.byte 0x65 # character e
.byte 0 # character \0
#----------Text Segment----------
.text
.globl __start __start:
la $s0, msg2 # load the ad