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

Section3.5Exercises

1

Develop an algorithm to convert signed decimal integers to 2's complement binary.

Hint Solution
2

Develop an algorithm to convert integers in 2's complement binary to signed decimal.

Hint Solution
3

The following 8-bit hexadecimal values are stored in two's complement code. What are the equivalent signed decimal numbers?

  1. \(\hex{55}\)

  2. \(\hex{ab}\)

  3. \(\hex{f0}\)

  4. \(\hex{0f}\)

  5. \(\hex{80}\)

  6. \(\hex{63}\)

  7. \(\hex{7b}\)

Hint Answer
4

The following 16-bit hexadecimal values are stored in two's complement code. What are the equivalent signed decimal numbers?

  1. \(\hex{1234}\)

  2. \(\hex{8765}\)

  3. \(\hex{5678}\)

  4. \(\hex{edcc}\)

  5. \(\hex{fedc}\)

  6. \(\hex{07e0}\)

  7. \(\hex{8000}\)

  8. \(\hex{7fff}\)

  9. \(\hex{8001}\)

Answer
5

Show how each of the following signed, decimal integers would be stored in 8-bit two's complement code. Give your answer in hexadecimal.

  1. \(+100\)

  2. \(-1\)

  3. \(-10\)

  4. \(+88\)

  5. \(-127\)

  6. \(-16\)

  7. \(-32\)

  8. \(-128\)

Answer
6

Show how each of the following signed, decimal integers would be stored in 16-bit two's complement format. Give your answer in hexadecimal.

  1. \(+31693\)

  2. \(-252\)

  3. \(+1024\)

  4. \(-1024\)

  5. \(-1\)

  6. \(-32768\)

  7. \(+32767\)

  8. \(-256\)

  9. \(-32767\)

  10. \(-128\)

Answer