Computer Organization and Design: The Hardware/Software Interface

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 University of California, Berkeley College of Engineering Computer Science Division EECS Spring 1999 John Kubiatowicz Prerequisite Quiz February 1, 1999 CS152 Computer Architecture and Engineering This prerequisite quiz will be used in determining class admissions. The use of calculators or notes is not allowed during this quiz. Good Luck! Your Name: SID Number: Discussion Section: 1 2 3 4 Total
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 [ This page left for π ] 3.141592653589793238462643383279502884197169399375105820974944
Background image of page 2
3 1) Assume that we have a 16 bit system that uses signed, two’s-complement integers. Perform the following conversions: -8 10 to base 2: D458 16 to base 2: 24 10 to base 16: (1111110110101100) 2 to base 16: FC34 16 to base 10:
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 2) Suppose that we start with the following C program for factorial: int fact (int n) { if ( n < 1 ) { return 1; } else { return n fact (n-1); } } Here is a translation of the program above into MIPS assembly language. fact: slt $s0,$a0,1 bne $s0,$zero,L1 add $v0,$zero,1 jr $ra L1: sub $sp,$sp,2 sw $a0,0($sp) sub $a0,$a0,1 jal fact lw $ra,4($sp) add $sp,$sp,2 mult $v0,$a0,$v0 jr $ra a) There are 6 mistakes in this translation. Fix them in the above listing.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 01/29/2008 for the course CS 152 taught by Professor Kubiatowicz during the Spring '04 term at University of California, Berkeley.

Page1 / 9

sp99 prerequisite quiz - University of California, Berkeley...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online