### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# Note for C SC 252 with Professor Homer at UA

### View Full Document

## 14

## 0

## Popular in Course

## Popular in Department

This 8 page Class Notes was uploaded by an elite notetaker on Friday February 6, 2015. The Class Notes belongs to a course at University of Arizona taught by a professor in Fall. Since its upload, it has received 14 views.

## Reviews for Note for C SC 252 with Professor Homer at UA

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 02/06/15

C80 252 7 Homework 1 Version 10 January 19 2014 Solutions to Problems Turned In 1 Assume that 16 bit two s complement binary numbers are being used in this problem Some binary arithmetic and conversions For each of the pairs of numbers below compute 3 points for each part 15 points for iv 15 points for v 30 points for question 1 a hexadecimal base 16 equivalents for both a and b assume unsigned numbers b octal base 8 equivalents for both a and b assume unsigned numbers c decimal base 10 equivalents for both a and b assume signed numbers d a b and indicate if over ow occurs assume signed numbers e a b by negating b and adding indicate if over ow occurs assume signed numbers iv turnin this one a 0110 1001 0001 1101 b 0011 1010 1100 1000 a hexadecimal a 0110 1001 0001 1101 69 1Dx b 0011 1010 1100 1000 3A C8x b octal a 0 110 100 100 011 101 64435ch b 0 011 101 011 001 000 c decimal a is a positive number 0110 1001 0001 1101 214213211232423222 16384 8192 2048 256 16 8 4 1 1 33 16384 8192 2048 256 16 8 4 1 26909 26909m b is a positive number 0011 1010 1100 1000 21321221129272623 8192 4096 2048 512 128 64 8 35 3 10mm 11 33 8 192 4096 2 048 lof8 C80 252 7 Homework 1 Version 10 January 19 2014 0100 1100 0001 1010 214 211 210 24 23 21 16384 2048 1024 16 8 2 13 16384 2048 1024 16 8 2 19482 19482m b is a negative number nd two s complement rst 1100 1010 0101 1000 0011 0101 1010 0111 Invert step 1 add 1 0011 0101 1010 1000 213 212 210 28 27 25 23 8192 4096 1024 256 128 32 8 33 8192 4096 1024 256 128 32 8 13736 13 736m d a b 1 111 1 1011 0011 1110 0110 1100 1010 0101 1000 0111 1110 0011 1110 overflow When adding negative negative the answer should be negative Since the answer here is positive there is over ow e a b Find the two s complement of b then add Two s complement of b 1100 1010 0101 1000 0011 0101 1010 0111 invert step 0011 0101 1010 1000 3amp8 C80 252 7 Homework 1 Version 10 January 19 2014 Now add a and the two s complement of b 11 1111 11 1011 0011 1110 0110 0011 0101 1010 1000 1110 1001 1000 1110 no overflow When subtracting negative negative over ow is not possible 5 turnin this one 15 points 5 points each part This exercise is similar to the previous one but this time use the bit pattern 1100 1001 0111 0011 0110 1011 0110 0001 What does it represent assuming that it is a a two s complement integer b an unsigned integer c a single precision oating point number d four ascii characters a The sign bit is 1 so this is a negative number Start by nding the two s complement 1100 1001 0111 0011 0110 1011 0110 0001 0011 0110 1000 1100 1001 0100 1001 1110 invert step 1 0011 0110 1000 1100 1001 0100 1001 1111 0011 0110 29 28 26 25 1000 1100 23 19 18 1001 0100 15 12 10 1001 1111 7 4 3 2 1 0 22922822622522321921821521221027 242322212 233 344 58 536870912 229 268435456 223 67108864 226 33554432 225 8388608 223 524288 219 262144 213 32768 215 4096 212 1024 210 128 27 16 24 8 23 4 22 4of8 C80 252 7 Homework 1 Version 10 January 19 2014 2 21 1 2 915182751 Answer 915182 751 ten b Assume an unsigned number 1100 1001 0111 0011 0110 1011 0110 0001 1100 1001 31 30 27 24 0111 0011 22 21 20 17 16 0110 1011 14 13 11 9 8 0110 0001 6 5 0 23123 22722422222122 217216214 213211292826252 122 565 77 2147483648 231 1073741824 23 134217728 227 16777216 224 4194304 222 2097152 221 1048576 220 131072 217 65536 216 16384 214 8192 213 2048 211 512 29 256 23 64 26 32 25 1 2 3379784545 Answer 3 379784545 ten c S Expo nent Sig nifi cand 1 1001 0001 111 0011 1110 1011 0110 0001 1 1001 0010 111 0011 0110 1011 0110 0001 new S 1 a negative number Exponent 1001 0010 27 241 2 128 16 2 146 Sof8 C80 252 7 Homework 1 Version 10 January 19 2014 subtract the bias 146 127 19ten Significand 111 0011 0110 1011 0110 0001 15 1 significant 219 11 1 111 0011 0110 1011 0110 0001 219 1 1111 0011 0110 1011 0110 0001 219 1 111 0011 0110 1011 01100001 Integer part 1 111 0011 0110 1011 0110 1111 0011 0110 1011 0110 21921321721621321221 2927 25242221 524288 219 262144 213 131072 217 65536 216 8192 213 4096 212 1024 210 512 29 128 27 32 25 16 24 4 22 2 21 997046 Fractional part 0001 23941 116 00625 Answer 9990940625ten d 1100 1001 0111 0011 0110 1011 0110 0001 1100 1001 not an ascii value since the high order bit is 1 0111 0011 0x73 2 S39 0110 1011 0x6B k 0110 0001 0X61 a 9 turnin this one 10 points 7 points part a 3 points part b This exercise is similar to the previous 3 but this time use 4134260937515quot a The number is negative The integer part 11342en 6of8 C80 252 7 Homework 1 Version 10 January 19 2014 2L11342 A 25671 0 22835 1 21417 1 2 708 1 10110001001110 2 354 0 2 177 o 2 88 1 2 44 0 2 22 0 2 11 0 2 5 1 2 2 1 2 1 0 0 1 11342151 101100 010011101 Convert the fractional part to a binary number Do this by subtracting successive negative powers of two When the number cannot be subtracted put a 0 in When the number can be subtracted put in a 1 0 6 09 3 7 5 0 5 2391 0 1 09 3 7 5 22 is 025 and is too large Put in 0 2393 is 0125 and is too large Put in 0 Subtract 2 4 0 1 09 3 7 5 0 062 5 2 394 0 046 87 5 Subtract 2 5 0 046 87 5 0 03 1 2 5 2 395 0 015 62 5 Subtract 2 5 0 015 62 5 0 015 62 5 2 396 0 0 done The fraction part is 0100111 7of8 C80 252 7 Homework 1 Version 10 January 19 2014 The binary equivalent is 10 1100 0100 1110100111 1011 0001 0011 1010 0111 213 sign is 1 since the number is negative exponent 13 127 140 1000 1100 significand 011 0001 0011 1010 0111 S Expo nent Sig nifi cand 1 1000 1100 011 0001 0011 1010 0111 0000 b There are two differences between single and double precision The exponent uses 11 digits and a bias of 1 023 There are more digits in the signi cand To convert the exponent 1000110027232212884140 subtract the bias 140 127 13 Now use a bias of 1023 13 1023 1036 21 23 22 100 0000 1100 The result is S Exp onen t Significand 1 100 0000 1100 0110 0010 0111 0100 1110 0000 0000 0000 0000 0000 0000 0000 0000 80f8

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

#### "I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over $600 per month. I LOVE StudySoup!"

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.