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

CDA 3100 Midterm Exam: MIPS & Binary Questions, Spring 2008 - Prof. Zhenghao Zhang, Exams of Electrical and Electronics Engineering

The midterm exam for cda 3100, a computer architecture course, held in spring 2008. The exam consists of multiple choice questions on topics such as binary representation and mips instructions. Students are required to select one answer for each question by circling the index of the answer and write a short explanation. The exam lasts for one hour and fifteen minutes.

Typology: Exams

Pre 2010

Uploaded on 08/31/2009

koofers-user-j70
koofers-user-j70 🇺🇸

10 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CDA 3100 Midterm Exam, Spring 2008
Name :
Instructions:
1. This is a close-book and close-notes exam.
2. You have one hour and fifteen 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.
1
pf3
pf4
pf5

Partial preview of the text

Download CDA 3100 Midterm Exam: MIPS & Binary Questions, Spring 2008 - Prof. Zhenghao Zhang and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

CDA 3100 Midterm Exam, Spring 2008

Name :

Instructions:

  1. This is a close-book and close-notes exam.
  2. You have one hour and fifteen 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.

1 Multiple Choice Questions

Please select one answer for each question by circling the index of the answer. Six 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. The binary representation for (^4095) ten in 16 bits is

(a) 0000111111111111 (b) 0001111111110011 (c) 1001100111110011 (d) None of the above.

  1. The binary representation for − (^43) ten in 8 bits is

(a) 01101101 (b) 11010101 (c) 11010100 (d) None of the above

  1. The single precision floating number representation of − 20. (^5) ten is

(a) 1 00000100 010 0000 0000 0000 0000 0000 (b) 1 10000011 010 0000 0000 0000 0000 0000 (c) 1 10000011 010 0100 0000 0000 0000 0000 (d) None of the above

(b) 0x (c) 0x (d) None of the above

  1. In MIPS, “bgt” is a pseudoinstruction. After executing instruction “bgt $t0, $t1, L,” the program should execute the instruction at the location labeled by L if the content in $t0 is greater than $t1, otherwise it will execute the next instruction. Which of the following correctly implements this instruction? (Hint: $at is the temporary register used to expand a pseudoinstruction to real instructions.)

(a) slt $at, $t1, $t bne $at, $0, L (b) slt $at, $t0, $t bne $at, $0, L (c) sub $at, $t0, $t beq $at, $0, L (d) None of the above

  1. Suppose a piece of C code is

if (a > b) c = a - b; else c = b - a;

and suppose a, b, c are in $t0, $t1, and $t2, respectively. Which of the following is the correct translation to MIPS? (Hint: for the meaning of bgt please refer to the previous problem.)

(a) bgt $t0, $t1, L sub $t2, $t0, $t L1: sub $t2, $t1, $t

(b) bgt $t0, $t1, L j L L1: sub $t2, $t0, $t L2: sub $t2, $t1, $t

(c) bgt $t0, $t1, L j L L1: sub $t2, $t1, $t L2: sub $t2, $t0, $t

(d) None of the above

  1. A C function f1 has a local integer array of 100 elements, and it calls another function f2. After complied into MIPS, which of the following statements is true?

(a) When this function is called, the stack will grow exactly 100 bytes. (b) When this function is called, the stack will grow exactly 400 bytes.. (c) When this function is called, the stack will grow no less than 404 bytes. (d) None of the above.

  1. Suppose your code is executing instruction “add $t0, $t1, $t2” located at 0x00400120 when an interrupt (for example, the keyboard interrupt) occurs. The interrupt processing code starts at