Data Types T1 Data Types, Binary and Hexadecimal
Data Types T1 Data Types, Binary and Hexadecimal
1
Objectives
• List and define primitive data types
• Represent positive integers in binary and
hexadecimal
• Convert between binary, hexadecimal and denary
Primitive data types, binary and hexadecimal
Unit 6 Data Types
Number symbols
• The denary number system uses a combination of
just ten symbols to represent any number
• Number systems are referred to by their base; that
is, the number of symbols used to construct values
• Denary is base 10 and the base may be referred to
as a subscript
• In denary the number 11, for example, may be written as 1110
• In binary, it would be written as 112 and in hexadecimal as
1116
• 1110, 112 and 1116 all represent different values
Primitive data types, binary and hexadecimal
Unit 6 Data Types
Base 2
• Numbers which use base 2 Denary Binary
are commonly referred to as 1 1
2 10
binary numbers
3 11
• Can you see a pattern in the 4 100
binary values? 5 101
6 110
7 111
8 1000
9 1001
10 1010
11 1011
Primitive data types, binary and hexadecimal
Unit 6 Data Types
Place value
• In any counting system, the position of the value
determines its contribution to the overall total
Number 1 8 3
Baseposition 27 26 25 24 23 22 21 20
Place value 128 64 32 16 8 4 2 1
Number 1 0 1 1 0 1 1 1
Digit value 128x1 0 32x1 16x1 0 4x1 2x1 1x1
• Therefore 1 0 1 1 0 1 1 12 represents
128 + 32 + 16 + 4 + 2 + 1 which is equivalent to 18310
Primitive data types, binary and hexadecimal
Unit 6 Data Types
Number 1 0 0 1 1 1 1 1
Activity
• Complete Task 1 in Worksheet 1
Primitive data types, binary and hexadecimal
Unit 6 Data Types
Hexadecimal – Base 16
• Number systems with bases above 10 often still use
0 to 9 but require extra symbols for values past 9
• An example of this is base 16 which is referred to as
the hexadecimal number system
• Hexadecimal uses letters for the values 10 to 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 ABCDEF
Primitive data types, binary and hexadecimal
Unit 6 Data Types
Hexadecimal values
• The rules of place value work in the same way:
43 ÷ 16 = 2 remainder 11
11 = B
= 2B
Significant powers
• Work out the following powers of 2:
20 =
21 =
22 =
23 =
24 =
• Why is the answer to 24 significant?
Primitive data types, binary and hexadecimal
Unit 6 Data Types
Significant powers
• Work out the following powers of 2:
20 = 1
21 = 2
22 = 4
23 = 8
24 = 16
• Why is the answer to 24 significant?
Primitive data types, binary and hexadecimal
Unit 6 Data Types
Significance of 16
• 16 is the fourth power of 2
• This means that base 16 numbers can be translated
from 4 consecutive bits of a binary value
• This makes it simple to translate binary numbers into
hexadecimal values and back again
8 4 2 1 8 4 2 1
216 = 1 1 0 1 1 0 0 0
= D 8
Primitive data types, binary and hexadecimal
Unit 6 Data Types
Activity
• Complete Task 2 on Worksheet 1
Primitive data types, binary and hexadecimal
Unit 6 Data Types
Plenary
• Denary numbers are easy to understand but they
are not easy to use in electronics
• Binary is simple to use with circuitry but is difficult to
read by humans
• Hexadecimal makes binary easier to read and easier
to transcribe (copy) accurately
Primitive data types, binary and hexadecimal
Unit 6 Data Types
Copyright
This unit and all the worksheets, PowerPoint presentations, teaching guides and other associated files
distributed with it are supplied to you by PG Online Limited under licence and may be used and copied by you
only in accordance with the terms of the licence. Except as expressly permitted by the licence, no part of the
materials distributed with this unit may be used, reproduced, stored in a retrieval system, or transmitted, in any
form or by any means, electronic or otherwise, without the prior written permission of PG Online Limited.
Licence agreement
This is a legal agreement between you, the end user, and PG Online Limited. This unit and all the worksheets,
PowerPoint presentations, teaching guides and other associated files distributed with it is licensed, not sold, to
you by PG Online Limited for use under the terms of the licence.
The materials distributed with this unit may be freely copied and used by members of a single institution on a
single site only. You are not permitted to share in any way any of the materials or part of the materials with any
third party, including users on another site or individuals who are members of a separate institution. You
acknowledge that the materials must remain with you, the licencing institution, and no part of the materials may
be transferred to another institution. You also agree not to procure, authorise, encourage, facilitate or enable any
third party to reproduce these materials in whole or in part without the prior permission of PG Online Limited.