Professional Documents
Culture Documents
Cpphtp5 AppD IM
Cpphtp5 AppD IM
Number
Systems
Here are only numbers
ratied.
William Shakespeare
OBJECTIVES
In this appendix you will learn:
2006 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
Introduction
Abbreviating Binary Numbers as Octal and Hexadecimal Numbers
Converting Octal and Hexadecimal Numbers to Binary Numbers
Converting from Binary, Octal or Hexadecimal to Decimal
Converting from Decimal to Binary, Octal or Hexadecimal
Negative Binary Numbers: Twos Complement Notation
Instructors Manual
Self-Review Exercises
D.1
The bases of the decimal, binary, octal and hexadecimal number systems are
,
and
respectively.
ANS: 10, 2, 8, 16.
D.2
In general, the decimal, octal and hexadecimal representations of a given binary number
contain (more/fewer) digits than the binary number contains.
ANS: Fewer.
D.3
(True/False) A popular reason for using the decimal number system is that it forms a convenient notation for abbreviating binary numbers simply by substituting one decimal digit per
group of four binary bits.
ANS: False. Hexadecimal does this.
D.4
The (octal / hexadecimal / decimal) representation of a large binary value is the most concise
(of the given alternatives).
ANS: Hexadecimal.
D.5
D.6
(True/False) The highest digit in any base is one more than the base.
ANS: False. The highest digit in any base is one less than the base.
(True/False) The lowest digit in any base is one less than the base.
D.7
The positional value of the rightmost digit of any number in either binary, octal, decimal
or hexadecimal is always
.
ANS: 1 (the base raised to the zero power).
D.8
The positional value of the digit to the left of the rightmost digit of any number in binary,
octal, decimal or hexadecimal is always equal to
.
ANS: The base of the number system.
D.9
Fill in the missing values in this chart of positional values for the rightmost four positions
in each of the indicated number systems:
decimal
hexadecimal
binary
octal
1000
...
...
512
100
256
...
...
10
...
...
8
1
...
...
...
ANS:
2006 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
Self-Review Exercises
decimal
hexadecimal
binary
octal
D.10
D.11
D.12
1000
4096
8
512
100
256
4
64
10
16
2
8
1
1
1
1
D.13 Convert hexadecimal 4FEC to octal. [Hint: First convert 4FEC to binary, then convert that
binary number to octal.]
ANS: Binary 0 100 111 111 101 100; Octal 47754.
D.14
D.15
D.16
D.17
to binary:
256 128 64 32 16 8 4 2 1
128 64 32 16 8 4 2 1
(1*128)+(0*64)+(1*32)+(1*16)+(0*8)+(0*4)+(0*2)+(1*1)
10110001
to octal:
512 64 8 1
64 8 1
(2*64)+(6*8)+(1*1)
261
to hexadecimal:
256 16 1
16 1
(11*16)+(1*1)
(B*16)+(1*1)
B1
D.18 Show the binary representation of decimal 417. Then show the ones complement of 417
and the twos complement of 417.
ANS: Binary:
512 256 128 64 32 16 8 4 2 1
256 128 64 32 16 8 4 2 1
(1*256)+(1*128)+(0*64)+(1*32)+(0*16)+(0*8)+(0*4)+(0*2)+(1*1)
110100001
2006 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
D.19
What is the result when a number and its twos complement are added to each other?
ANS: Zero.
Exercises
D.1
Some people argue that many of our calculations would be easier in the base 12 number
system because 12 is divisible by so many more numbers than 10 (for base 10). What is the lowest
digit in base 12? What would be the highest symbol for the digit in base 12? What are the positional
values of the rightmost four positions of any number in the base 12 number system?
ANS: The lowest digit is 1. The highest symbol is C. 1728, 144, 12, 1.
D.2
Complete the following chart of positional values for the rightmost four positions in each
of the indicated number systems:
decimal
base 6
base 13
base 3
1000
...
...
27
100
...
169
...
10
6
...
...
1
...
...
...
1000
216
2197
27
100
36
169
9
10
6
13
3
1
1
1
1
ANS:
decimal
base 6
base 13
base 3
D.3
D.4
D.5
Convert hexadecimal 765F to octal. [Hint: First convert 765F to binary, then convert that
binary number to octal.]
ANS: 73137.
D.6
D.7
D.8
D.9
ANS: 278.
ANS: 65535.
2006 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.
Exercises
D.10 Show the binary representation of decimal 779. Then show the ones complement of 779
and the twos complement of 779.
ANS: Binary
1100001011,
0011110101.
D.11
Ones
complement
0011110100,
Twos
complement
Show the twos complement of integer value 1 on a machine with 32-bit integers.
ANS: 00000000000000000000000000000001.
2006 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved.