DOC PREVIEW
Berkeley COMPSCI 61C - CS61C Midterm

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1/11 University of California, Berkeley – College of Engineering Department of Electrical Engineering and Computer Sciences Summer 2010 Instructor: Paul Pearce 2010-07-16  CS61C Midterm After the exam, indicate on the line above where you fall in the emotion spectrum between “sad” & “smiley”... Last Name Answer Key First Name Student ID Number Login cs61c- Login First Letter (please circle) a b c d e f g h i j k l m Login Second Letter (please circle) a b c d e f g h i j k l m n o p q r s t u v w x y z The name of your LAB TA (please circle) Eric Tom Noah Alex Name of the person to your Left Name of the person to your Right All the work is my own and I have collaborated with no one. I had no prior knowledge of the exam contents nor will I share the contents with others in CS61C who have not taken it yet. (Please sign) a) Instructions (Read Me!) - Don’t Panic! - This booklet contains 12 numbered pages including the cover page and MIPS reference guide. Put all answers on these pages; don’t hand in any stray pieces of paper. - Please turn off all pagers, cell phones & beepers. Remove all hats & headphones. Sit in every other seat. Nothing may be placed in the “no fly zone” spare seat/desk between students. - Question 0 (1 point) involves filling in the front of this page and putting your login on every sheet of paper. - You have 180 minutes to complete this exam. The exam is closed book, no computers, PDAs, calculators. You are allowed 1 page of notes, front and back. - A MIPS reference sheet has been provided as the last page of this handout. You should rip it off. - There may be partial credit for incomplete answers; write as much of the solution as you can. We will deduct points if your solution is far more complicated than necessary. When we provide a blank, please fit your answer within the space provided. You have 3 hours...relax. Question 0 1 2 3 4 5 6 Total Minutes 1 15 20 25 15 20 25 (+59 to review) = 180 Points 1 39 20 50 20 25 35 190 Score 1 39 20 50 20 25 35 190Login: cs61c-__Answers__ 2/11 Question 1: Where’s the kitchen sink? ……………….……………… (39 pts, 15 min) Part 1: CS61C trivia True/False: Circle the correct answer in the right-hand column. a) You must use the addu instruction to add unsigned numbers. T F b) You do not need to save volatile registers if your code doesn’t call any subfunctions. T F c) You do not need to save volatile registers if they won’t be modified by any subfunctions. T F d) We add a bias to floating point exponents to increase the range of values we can represent. T F e) The instructions srl and sra behave identically on positive (2’s complement) numbers. T F f) There are situations where using first-fit will cause less fragmentation than best-fit. T F g) The size of a structure that contains only 2 ints and 1 char will be 9 bytes. T F Fill in the blank: neatly write your answer in the right-hand column h) How many things can you represent with N bits? 2N i) Suppose you are given N bits. How many more bits would you need if we wished to triple the number of things we wanted to represent? 2 j) Assuming the following C code declaration: char str[] = “Hello World”; What will sizeof(str) return? 12 k) Assuming the following C code declaration: char *str = “Hello World”; What will sizeof(str) return? 4 l) Assuming the following C code declaration: char str[] = “Hello\0World”; What will strlen(str) return? 5 (Continued on next page)Login: cs61c-____ 3/11 Question 1: Where’s the kitchen sink? (Continued) ………………… (39 pts, 15 min) Part 2: Number representation So far we have studied 4 different methods for representing integers using 32-bits. These methods can be generalized to any number of bits. Fill in the bit patterns for the following 4-bit numbers. If there are multiple bit patterns for a given number, write them all. If no bit pattern exists to represent the given number, write “N/A” in the box (don’t leave it blank!). The first one has been done for you already. Unsigned Sign & Magnitude One’s Complement Two’s Complement 0 0000 0000, 1000 0000, 1111 0000 -1 N/A 1001 1110 1111 15 1111 N/A N/A N/A Now fill in the decimal (base 10) value for the following 4-bit numbers. The first one has been done for you already. Unsigned Sign & Magnitude One’s Complement Two’s Complement Number with bit pattern 0b1100 12 -4 -3 -4 Number closest to + 15 7 7 7 Number closest to - 0 -7 -7 -8 Part 3: Compiling/Linking/Loading Fill in the blanks to specify during what stage each action occurs. Use abbreviations CO=Compiling, AS=Assembly, LI=Linking, LO=Loading. __LI__ Jump labels are resolved __AS__ Short branch labels are resolved __LO__ The operating system handles this stage __CO__ Code is translated from C->MAL __AS__ Code is translated from MAL->TALLogin: cs61c-__Answers__ 4/11 Question 2: Did somebody say “Free Lunch”?! ……………………… (20 pts, 20 min) Consider the following 10-bit floating-point format. It contains the same fields (sign, exponent, significand) and follows the same general rules as the 32-bit IEEE standard (denorms, biased exponent, non-numeric values, etc.). It simply allocates its bits differently. Please answer the following questions, and show all your work in the space provided. We went ahead and got you started. Number represented by 0x00: ______ ___0_ # Bits in the Mantissa: ____________6__________ a) Exponent Bias: ____ 3 b) Implicit exponent for denormalized #’s: ____ -2 c) # of Numbers between (2 ≤ n < 8): ____ 128 d) Largest number x such that x + .5 = .5: ____ 2-8 = 1/256 (Continued on next page)S EEE MMMMMMLogin: cs61c-____ 5/11 Question 2: Did somebody say “Free Lunch”?! (Continued) ………. (20 pts, 20 min) (Repeated so you don’t need to flip back and forth) e) Difference between the two smallest positive values: ____ 2-8 = 1/256 _ f) Difference between the two largest non- positive values: ____ 2-3 = 1/8 g) Number of NaN’s: ____ 126


View Full Document

Berkeley COMPSCI 61C - CS61C Midterm

Documents in this Course
SIMD II

SIMD II

8 pages

Midterm

Midterm

7 pages

Lecture 7

Lecture 7

31 pages

Caches

Caches

7 pages

Lecture 9

Lecture 9

24 pages

Lecture 1

Lecture 1

28 pages

Lecture 2

Lecture 2

25 pages

VM II

VM II

4 pages

Midterm

Midterm

10 pages

Load more
Download CS61C Midterm
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CS61C Midterm and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CS61C Midterm 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?