Invitation to Computer Science 8th Edition

Published by Cengage Learning
ISBN 10: 1337561916
ISBN 13: 978-1-33756-191-4

Chapter 4 - 4.2 - The Binary Numbering System - Practice Problems - Page 166: 7

Answer

$Answer\ of\ a:$ To see what this value would look like in ASCII, we first look up the characters $“X”$, $“+”$, and $“Y”$ in the ASCII conversion table to see what their internal representation is in decimal. $\ \ \ \ \ \ "X"=88$ $\ \ \ \ \ \ "+"=43$ $\ \ \ \ \ \ "Y"=89$ We then convert these decimal values to unsigned 8 -bit binary values. $\ \ \ \ \ \ “X” = 88 = 01011000$ $\ \ \ \ \ \ “+” = 43 = 00101011$ $\ \ \ \ \ \ “Y” = 89 = 01011001$ The internal representation of the three-character string $‘X+Y’$ is formed by putting together all three of the preceding values, producing the following $24-bit$ string: $010110000010101101011001$ which is how a computer stores $‘X + Y’$ using ASCII encoding. --- $Answer\ of\ b:$ From the Unicode tables, $\ \ \ \ \ \ “X” = 0058$ $\ \ \ \ \ \ “+” = 002B$ $\ \ \ \ \ \ “Y” = 0059$ where these representations are in hexidecimal (base 16) form. In base 16, digits run from 0–F rather than 0–9 as in the decimal system. Translating these representations into decimal, we get $\begin{aligned} {"X"} &=0 \times 16^{3}+0 \times 16^{2}+5 \times 16^{1}+8 \times 16^{0} \\ &=80+8 \\ &=88 \\ {"+"} &=0 \times 16^{3}+0 \times 16^{2}+2 \times 16^{1}+11 \times 16^{0} \\ &=32+11 \\ &=43 \\ {"Y"} &=0 \times 16^{3}+0 \times 16^{2}+5 \times 16^{1}+9 \times 16^{0} \\ &=80+9 \\ &=89 \end{aligned}$ These are the same decimal values as under ASCII encoding (Unicode for common characters agrees with ASCII encoding) but will be written in 16-bit binary form, with extra spaces for readability. $\ \ \ \ \ \ “X” = 88 = 0000\ 0000\ 0101\ 1000$ $\ \ \ \ \ \ “+” = 43 = 0000\ 0000\ 0010\ 1011$ $\ \ \ \ \ \ “Y” = 89 = 0000\ 0000\ 0101\ 1001$ Putting these together produces the following 48-bit string for $‘X+Y’$: $0000\ 0000\ 0101\ 1000\ 0000\ 0000\ 0010\ 1011\ 0000\ 0000\ 0101\ 1001$

Work Step by Step

$Answer\ of\ a:$ To see what this value would look like in ASCII, we first look up the characters $“X”$, $“+”$, and $“Y”$ in the ASCII conversion table to see what their internal representation is in decimal. $\ \ \ \ \ \ "X"=88$ $\ \ \ \ \ \ "+"=43$ $\ \ \ \ \ \ "Y"=89$ We then convert these decimal values to unsigned 8 -bit binary values. $\ \ \ \ \ \ “X” = 88 = 01011000$ $\ \ \ \ \ \ “+” = 43 = 00101011$ $\ \ \ \ \ \ “Y” = 89 = 01011001$ The internal representation of the three-character string $‘X+Y’$ is formed by putting together all three of the preceding values, producing the following $24-bit$ string: $010110000010101101011001$ which is how a computer stores $‘X + Y’$ using ASCII encoding. --- $Answer\ of\ b:$ From the Unicode tables, $\ \ \ \ \ \ “X” = 0058$ $\ \ \ \ \ \ “+” = 002B$ $\ \ \ \ \ \ “Y” = 0059$ where these representations are in hexidecimal (base 16) form. In base 16, digits run from 0–F rather than 0–9 as in the decimal system. Translating these representations into decimal, we get $\begin{aligned} {"X"} &=0 \times 16^{3}+0 \times 16^{2}+5 \times 16^{1}+8 \times 16^{0} \\ &=80+8 \\ &=88 \\ {"+"} &=0 \times 16^{3}+0 \times 16^{2}+2 \times 16^{1}+11 \times 16^{0} \\ &=32+11 \\ &=43 \\ {"Y"} &=0 \times 16^{3}+0 \times 16^{2}+5 \times 16^{1}+9 \times 16^{0} \\ &=80+9 \\ &=89 \end{aligned}$ These are the same decimal values as under ASCII encoding (Unicode for common characters agrees with ASCII encoding) but will be written in 16-bit binary form, with extra spaces for readability. $\ \ \ \ \ \ “X” = 88 = 0000\ 0000\ 0101\ 1000$ $\ \ \ \ \ \ “+” = 43 = 0000\ 0000\ 0010\ 1011$ $\ \ \ \ \ \ “Y” = 89 = 0000\ 0000\ 0101\ 1001$ Putting these together produces the following 48-bit string for $‘X+Y’$: $0000\ 0000\ 0101\ 1000\ 0000\ 0000\ 0010\ 1011\ 0000\ 0000\ 0101\ 1001$
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.