exam1-f05

# exam1-f05 - Andrew login ID: Full Name: CS 15-213, Fall...

This preview shows pages 1–4. Sign up to view the full content.

Andrew login ID: Full Name: CS 15-213, Fall 2005 Exam 1 Tuesday October 11, 2005 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front. Write your answers in the space provided below the problem. If you make a mess, clearly indicate your final answer. The exam has a maximum score of 58 points. The problems are of varying difficulty. The point value of each problem is indicated. Pile up the easy points quickly and then come back to the harder problems. This exam is OPEN BOOK. You may use any books or notes you like. No electronic devices are allowed. Good luck! 1 (10): 2 (12): 3 (04): 4 (05): 5 (06): 6 (05): 7 (08): 8 (08): TOTAL (58): Page 1 of 11

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

View Full Document
Problem 1. (10 points): Assume we are running code on a 7 -bit machine using two’s complement arithmetic for signed integers. Fill in the empty boxes in the table below. The following definitions are used in the table: int x = -16; unsigned uy = x; You need not fill in entries marked with “–”. TMax denotes the largest positive two’s complement number and TMin denotes the smallest negative two’s complement number. Hint: Be careful with the promotion rules that C uses for signed and unsigned ints. Expression Decimal Representation Binary Representation - 2 001 0011 x uy x - uy TMax + 1 TMin - 1 -TMin TMin + TMin TMax + TMin Page 2 of 11
Problem 2. (12 points): Consider the following two 7-bit floating point representations based on the IEEE floating point format. Neither of them have sign bits—they can only represent nonnegative numbers. 1. Format A There are k = 3 exponent bits. The exponent bias is 3. There are n = 4 fraction bits. 2. Format B There are k = 4 exponent bits. The exponent bias is 7. There are n = 3 fraction bits. Numeric values are encoded in both of these formats as a value of the form V = M × 2 E , where E is exponent after biasing, and M is the significand value. The fraction bits encode the significand value M using either a denormalized (exponent field 0) or a normalized representation (exponent field nonzero). Below, you are given some bit patterns in Format A, and your task is to convert them to the closest value in

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 06/28/2008 for the course CS 15-213 taught by Professor Fr during the Spring '07 term at Carnegie Mellon.

### Page1 / 11

exam1-f05 - Andrew login ID: Full Name: CS 15-213, Fall...

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

View Full Document
Ask a homework question - tutors are online