Computer Science: An Overview: Global Edition (12th Edition)

Published by Pearson Higher Education
ISBN 10: 1292061162
ISBN 13: 978-1-29206-116-0

Chapter 1 - Data Storage - Chapter Review Problems - Page 87: 30

Answer

(a) 21 (b) -22 (c) -10 (d) 27 (e) -7

Work Step by Step

To convert two' s complement to decimal representation we use the following steps - 1. Note the first bit, if this is 1 then the number is negative otherwise positive or zero. 2. Flip all the bits. 3. Add 1 to the number 4. Convert to decimal like regular binary number and add the sign calculated in the step 1. a. 010101 MSB = 0 → positive Binary → Decimal: 0×32+1×16+0×8+1×4+0×2+1×1=16+4+1=21 Decimal = 21 b. 101010 MSB = 1 → negative Find two’s complement: invert → 010101, add 1 → 010110 010110 = 16 + 4 + 2 = 22 Add negative sign → -22 Decimal = -22 c. 110110 MSB = 1 → negative Invert → 001001, add 1 → 001010 001010 = 2 + 8 = 10 Add negative sign → -10 Decimal = -10 d. 011011 MSB = 0 → positive Binary → Decimal: 0×32 + 1×16 + 1×8 + 0×4 + 1×2 + 1×1 = 16 + 8 + 2 + 1 = 27 Decimal = 27 e. 111001 MSB = 1 → negative Invert → 000110, add 1 → 000111 000111 = 4 + 2 + 1 = 7 Add negative sign → -7 Decimal = -7
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.