Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Practice Questions for Midterm Exam - Computer Organization | CDA 3100, Exams of Electrical and Electronics Engineering

Material Type: Exam; Professor: Zhang; Class: COMPUTER ORG I; Subject: COMPUTER DESIGN/ARCHITECTURE; University: Florida State University; Term: Fall 2009;

Typology: Exams

2010/2011

Uploaded on 02/17/2011

andrew-babitt
andrew-babitt 🇺🇸

1 document

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CDA3100 Midterm Exam, Fall 2009
Name :
Instructions:
1. This is a close-book and close-notes exam.
2. You have 75 minutes to answer the questions.
3. Please write down your name on the top of this page first before you start answering any
question. Answer all questions directly on the exam papers. If you need additional sheets,
please let me know.
4. Partial credit is possible for an answer. However, please try to be concise and make your
exam as neat as possible.
pf3
pf4
pf5
pf8

Partial preview of the text

Download Practice Questions for Midterm Exam - Computer Organization | CDA 3100 and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

CDA3100 Midterm Exam, Fall 2009

Name :

Instructions:

1. This is a close-book and close-notes exam.

2. You have 75 minutes to answer the questions.

3. Please write down your name on the top of this page first before you start answering any

question. Answer all questions directly on the exam papers. If you need additional sheets,

please let me know.

4. Partial credit is possible for an answer. However, please try to be concise and make your

exam as neat as possible.

Part I. Multiple choice questions. Please select one answer for each question by circling the index of the answer. 8 points for each question. You may also write down a short sentence in the provided space to explain your choice. If your choice is wrong but your explanation is partially correct, partial credit will be given.

  1. What is the binary representation for 1030 10 in 16 bits? (a). 0000 0100 0000 0110 (b). 0000 0100 0000 0010 (c). 0010 0000 0000 0110 (d) None of the above. (a).
  2. What is the two’s complement binary representation for -80 10 in 8 bits? (a). 1000 0111 (b). 1011 0000 (c). 1101 1011 (d). None of the above. (b)
  3. What is 15.5 10 represented as a single precision float number? (a). 0 10000010 111 1000 0000 0000 0000 0000 (b). 0 10000011 111 0000 0000 0000 0000 0000 (c). 0 10000010 111 0000 0000 0000 0000 0000 (d). None of the above.
  1. Consider the following C code if (i == j) i++; else j++; and assume i is in $t0 and j is in $t1. Which of the following correctly implements the C code? (a). beq $t0, $t1, L addi $t0, $t0, 1 L1: addi $t1, $t1, 1 (b). beq $t0, $t1, L addi $t0, $t0, 1 j L L1: addi $t1, $t1, 1 L2: … (c). bne $t0, $t1, L addi $t0, $t0, 1 j L L1: addi $t1, $t1, 1 L2: … (d). None of the above. (c)
  2. In MIPS, la $t0, L1’’ is a pseudo instruction which loads the address of associated with L1 into a register $t0. Now supposejal’’ is not supported by hardware and is a pseudo instruction. Which of the following correctly implements instruction ``jal f1’’?

(a) la $ra, L j f L1: nop # or any instruction after calling the f1 function (b) la $t0, f jr f L1: nop # or any instruction after calling the f1 function (c) la $ra, f j f L1: nop # or any instruction after calling the f1 function (d) None of the above. (a)

  1. Which of the following statements about MIPS function call convention is true? (a). A function always has to save $ra. (b). If the function has to use $t0-$t9, they must be saved using the stack. (c). Both of the above. (d). None of the above. (d)
  2. Which of the following statements is true? (a). An interrupt handler usually saves $at because the interrupt may occur at any moment.

Part II. Short answer questions

  1. ( 10 points) Write a function called “fact” that takes a number passed in $a0 and calculates the factorial of this number and put the result in $v0. Do not use more than 5 instructions for this function. 2 points will be deducted for each addition instruction until the no more points are left. fact: li $v0, 1 fact_loop: mul $v0, $v0, $a addi $a0, $a0, - bne $a0, $0, fact_loop jr $ra
  2. ( 10 points) Please read the following code and write down the content in array C after function1 returns. 5,1,5,3,5,5,6,5,8,5, .data A: .word 0,1,2,3,4,5,6,7,8, B: .word 5,5,5,5,5,5,5,5,5, C: .word 0,1,2,3,4,5,6,7,8, .text .globl main main: la $a0, A la $a1, B la $a2, C li $a3, 10 jal function li $v0,10 # exit syscall function1: li $t0, 0 function1L0:

sll $t1, $t0, 2 add $t2, $t1, $a add $t3, $t1, $a add $t4, $t1, $a lw $t5, 0($t2) lw $t6, 0($t3) blt $t5, $t6, function1L1 # goto function1L1 if $t5 l $t addi $t7, $t6, 0 addi $t6, $t5, 0 addi $t5, $t7, 0 function1L1: andi $t8, $t0, 1 beq $t8, $0, function1L sw $t5, 0($t4) j function1L function1L2: sw $t6, 0($t4) function1L3: addi $t0, $t0, 1 bne $t0, $a3, function1L jr $ra