###### 1

Convert \(123_{10}\) to binary.

\(\newcommand{\doubler}[1]{2#1}
\newcommand{\binary}{\mathtt}
\newcommand{\hex}{\mathtt}
\newcommand{\octal}{\mathtt}
\newcommand{\prog}{\mathtt}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\)

Convert \(123_{10}\) to binary.

Convert the following unsigned decimal integers to 8-bit hexadecimal representation:

\(100\)

\(125\)

\(10\)

\(88\)

\(255\)

\(16\)

\(32\)

\(128\)

Answer

\(\hex{64}\)

\(\hex{7d}\)

\(\hex{0a}\)

\(\hex{58}\)

\(\hex{ff}\)

\(\hex{10}\)

\(\hex{20}\)

\(\hex{80}\)

Convert the following unsigned decimal integers to 16-bit hexadecimal representation:

\(1024\)

\(1000\)

\(32768\)

\(32767\)

\(256\)

\(65535\)

\(4660\)

\(43981\)

Answer

\(\hex{0400}\)

\(\hex{03e8}\)

\(\hex{8000}\)

\(\hex{7fff}\)

\(\hex{0100}\)

\(\hex{ffff}\)

\(\hex{1234}\)

\(\hex{abcd}\)

Invent a code that would allow us to store letter grades with plus or minus. That is, the grades A, A-, B+, B, B-,…, D, D-, F. How many bits are required for your code?

Answer

Since there are 12 values, we need 4 bits. Any 4-bit code would work. Here is one example:

Grade | Code | (in hex) |

A | \(\binary{0000}\) | \(\hex{0}\) |

A- | \(\binary{0001}\) | \(\hex{1}\) |

B+ | \(\binary{0010}\) | \(\hex{2}\) |

B | \(\binary{0011}\) | \(\hex{3}\) |

B- | \(\binary{0100}\) | \(\hex{4}\) |

C+ | \(\binary{0101}\) | \(\hex{5}\) |

C | \(\binary{0110}\) | \(\hex{6}\) |

C- | \(\binary{0111}\) | \(\hex{7}\) |

D+ | \(\binary{1000}\) | \(\hex{8}\) |

D | \(\binary{1001}\) | \(\hex{9}\) |

D- | \(\binary{1010}\) | \(\hex{a}\) |

F | \(\binary{1011}\) | \(\hex{b}\) |