Docsity

Assignment 2 Questions - Computer Organization | CPSC 2105, Assignments of Computer Architecture and Organization

Toggle sidebar
bg1
CPSC 2105 Introduction to Computer Organization
Homework Set 1 Due Monday, January 23, 2006
Homework key with answers and comments.
Each of these questions counts 20 points.
1. Convert the following decimal numbers to binary numbers.
The numbers are unsigned. Use as many bits as necessary.
a) 63 b) 125 c) 104
ANSWER:
a) 63 = 32 + 31 = 32 + 16 + 8 + 4 + 2 + 1 011 1111
63 / 2 31 rem 1
31 / 2 15 rem 1
15 / 2 7 rem 1
7 / 2 3 rem 1
3 / 2 1 rem 1
1 / 2 0 rem 1
b) 125 = 64 + 61 = 64 + 32 + 29 = 64 + 32 + 16 + 13
= 64 + 32 + 16 + 8 + 4 + 1 0111 1101
125 / 2 62 rem 1
62 / 2 31 rem 0
31 / 2 15 rem 1
15 / 2 7 rem 1
7 / 2 3 rem 1
3 / 2 1 rem 1
1 / 2 0 rem 1
c) 104 = 64 + 40 = 64 + 32 + 8 0110 1000
104 / 2 52 rem 0
52 / 2 26 rem 0
26 / 2 13 rem 0
13 / 2 6 rem 1
6 / 2 3 rem 0
3 / 2 1 rem 1
1 / 2 0 rem 1
Page 1 of 4 Homework Key Revised 01/23/2006
pf3
pf4

Partial preview of the text

Download Assignment 2 Questions - Computer Organization | CPSC 2105 and more Assignments Computer Architecture and Organization in PDF only on Docsity!

CPSC 2105 Introduction to Computer Organization

Homework key with answers and comments. Each of these questions counts 20 points.

  1. Convert the following decimal numbers to binary numbers.
  1. Convert the following octal numbers to decimal numbers. Use as many decimal digits as necessary. a) 077 b) 126 c) 100 ANSWER: Recall that 8^0 = 1, 8^1 = 8, 8^2 = 64, and 8^3 = 512. a) 0778 = 0 82 + 7 81 + 71 = 78 + 71 = 56 + 7 = 63 b) 1268 = 1 82 + 2 81 + 61 = 164 + 28 + 61 = 64 + 16 + 6 = 86. c) 1008 = 64
  2. Convert the following hexadecimal numbers to decimal numbers. Use as many decimal digits as necessary. a) 0x077 b) 0xCAB c) 0x ANSWER: Recall that 16^0 = 1, 16^1 = 16, 16^2 = 256, and 16^3 = 4096. Also A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15. a) 0x077 = 716 + 7 = 112 + 7 = 119 b) 0xCAB = 12 162 + 10 161 + 111 = 3072 + 160 + 11 = 3243 c) 0x100 = 256
  3. What is the range of decimal numbers that can be represented in: a) 20–bit two’s–complement form? Express this range in decimal. b) 32–bit two’s–complement form? This range can be expressed in any valid manner. ANSWER: N–bit two’s–complement representation stores from –2N-1^ to 2N-1^ – 1 a) 20–bit two’s complement: –2^19 to 2^19 – 1 - 524, 288 to 524, 287 a) 32–bit two’s complement: –2^31 to 2^31 – 1 - 2, 147, 483, 648 to 2, 147, 483, 647
  • Homework Set 1 Due Monday, January 23,
    • a) 63 b) 125 c) The numbers are unsigned. Use as many bits as necessary.
    • a) 63 = 32 + 31 = 32 + 16 + 8 + 4 + 2 + ANSWER:
    • 63 / 2 31 rem
    • 31 / 2 15 rem
    • 15 / 2 7 rem
    • 7 / 2 3 rem
    • 3 / 2 1 rem
    • 1 / 2 0 rem
    • b) 125 = 64 + 61 = 64 + 32 + 29 = 64 + 32 + 16 +
      • = 64 + 32 + 16 + 8 + 4 +
    • 125 / 2 62 rem
    • 62 / 2 31 rem
    • 31 / 2 15 rem
    • 15 / 2 7 rem
    • 7 / 2 3 rem
    • 3 / 2 1 rem
    • 1 / 2 0 rem
    • c) 104 = 64 + 40 = 64 + 32 +
    • 104 / 2 52 rem
    • 52 / 2 26 rem
    • 26 / 2 13 rem
    • 13 / 2 6 rem
    • 6 / 2 3 rem
    • 3 / 2 1 rem
    • 1 / 2 0 rem
      • a) 25. This is not a problem in conversion to IEEE–754 floating point standard.
      • b) 127.
      • c) 63.
      • d) 24.
  • a) 25 = 16 + 9 = 16 + 8 + ANSWER:
    • 0.375 = 3/8 = 1/4 + 1/8 = 0.011 1 1001. - 0001 1001.0110 19.
    • 25 / 2 12 rem 1 0.375 2 0.750
    • 12 / 2 6 rem 0 0.750 2 1.500
    • 6 / 2 3 rem 0 0.500 2 1.00
    • 3 / 2 1 rem 1 0.000 2 0.00
    • 1 / 2 0 rem
    • 0 / 2 0 rem
  • b) 127.
    • 127 = 64 + 32 + 16 + 8 + 4 + 2 + 1 =
    • 0.75 = 1/2 + 1/4 = 0.11 111 1111.
    • 127 / 2 63 rem 1 0.75 2 1.50 0111 1111.1100 3F.C
    • 63 / 2 31 rem 1 0.50 2 1.00
    • 31 / 2 15 rem 1 0.00 2 0.00
    • 15 / 2 7 rem
    • 7 / 2 3 rem
    • 3 / 2 1 rem
    • 1 / 2 0 rem
    • 0 / 2 0 rem
  • c) 63.
    • 63 = 32 + 31 = 32 + 16 + 8 + 4 + 2 + 1 =
    • 0.8125 = 0.75 + 0.0625 = 1/2 + 1/4 + 1/16 = 0.1101 11 1111.
    • 63 / 2 31 rem 1 0.8125 2 1.625 0011 1111.1101 = 3F.D
    • 31 / 2 15 rem 1 0.625 2 1.25
    • 15 / 2 7 rem 1 0.25 2 0.50
    • 7 / 2 3 rem 1 0.50 2 1.00
    • 3 / 2 1 rem 1 0.00 2 0.00
    • 1 / 2 0 rem
    • 0 / 2 0 rem
  • d) 24.
    • 24 = 16 + 8 1 1000.
      • 0001 1000.00 18.