NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
PST SC015 Chapter 2 Computer System 2017/2018
1. 1
Chapter Two
NUMBER SYSTEM AND
REPRESENTATION
2.2 Number System
2.2.1 Binary
2.2.2 Hexadecimal
2.2.3 Conversion Between Binary and
Hexadecimal
2. Define Number
System
● A set of numerals for representing
numbers
Decimal Numbers (base 10)
Binary Numbers (base 2)
Hexadecimal Numbers (base 16)
Page 260
Figure 5-2
2
Discovering Computers : Chapter 5
3. Decimal Numbers
● Consists of numbers 0-9
● Decimal digits are joined together to form
longer decimal numbers
● Example: 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,
12,………
● also known as the base 10 numbering system
3
6 1 5
6 x 10^2 1 x 10^1 5 x 10^0
6 x 100 1 x 10 5 x 1
600 + 10 + 5 = 615
4. At the end of this topic, students
should be able to:
represent data in binary forma)
1
Chapter Two
NUMBER SYSTEM AND
REPRESENTATION
2.2.1 Binary
5. Binary Numbers
● Machine recognises two states: 0 (off) and 1
(on)
● Binary number represents numeric values
using two symbols, 0 and 1
● Eg : 111000, 101 111 111
2
7. At the end of this topic, students
should be able to:
represent data in hexadecimal forma)
1
Chapter Two
NUMBER SYSTEM AND
REPRESENTATION
2.2.2 Hexadecimal
8. Hexadecimal Numbers
● Uses 16 symbols: 0,1,2, 3, 4, 5, 6, 7, 8, 9, A, B,
C, D, E and F.
● It can represent binary values in compact
form.
● 9B416
is example of hexadecimal numbers.
2
9. Comparison Between Decimal Number
and Hexadecimal Number
3
DECIMAL HEXADECIMAL
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
DECIMAL HEXADECIMAL
10 A
11 B
12 C
13 D
14 E
15 F
16 10
17 11
20 14
35 23
10. 4
Decimal Hexadecimal Binary
0 0 0
1 1 1
2 2 10
3 3 11
4 4 100
5 5 101
6 6 110
7 7 111
8 8 1000
9 9 1001
10 A 1010
11 B 1011
12 C 1100
13 D 1101
14 E 1110
15 F 1111
Comparison Between Number System
11. At the end of this topic, students
should be able to:
a. convert from binary to hexadecimal
b. convert from hexadecimal to binary
1
Chapter Two
NUMBER SYSTEM AND
REPRESENTATION
2.2.3 Conversion Between Binary and Hexadecimal
12. Conversion Between Number System
● Decimal to Binary
● Binary to Decimal
● Decimal to Hexadecimal
● Hexadecimal to Decimal
● Binary to Hexadecimal
● Hexadecimal to Binary
2
14. Binary
number
2
2 ---- 0
---- 1
2
2
---- 1
---- 0
22
11
5
2
1
0 ---- 1
Hence, 22 = 10110 2
Eg 1: Convert the number 22 to the binary
number system. Solution : 22
=
2
2
Write from bottom to
top → left to right
Decimal to binary conversion
4
15. Eg 2: Convert the number 40 to the
binarynumber system. Solution : 40 =
2
2
2
2
2
2
2
40
20
10
5
2
1
0
---- 0
---- 0
---- 0
---- 1
---- 0
---- 1
Binary
number
Hence, 40 = 101000 2
Write from bottom to
top → left to right
Decimal to binary conversion
5
16. 2
2
2
2
2
18
9
4
2
1
0
---- 0
---- 1
---- 0
---- 0
---- 1
Binary
number
Hence, 18 = 100102
Eg 3:Express 18 in binary number form
Solution 18 = 2
Write from bottom to
top → left to right
Decimal to binary conversion
6
18. ● In binary number, the column weights
(again from right to left) are as follows:
● Eg : convert 1011 2 to decimal number
Binary to Decimal conversion
1 0 1 1
1 x (2^3) 0 x (2^2) 1 x (2^1) 1 x (2^0)
1 x 8 0 x 4 1 x 2 1 x 1 Decimal number
8 0 2 1
8+0+2+1=1110
Binary to decimal conversion
CONVERSION
Eg 1: Convert the number 10112 to the
decimal
8
19. Hence, 10110 2 = 22
Eg 1: Convert the binary number 10110 2 to
decimal number
Solution:
1 0 1 1 0
1 x 2^4 0 x 2^3 1 x 2^2 1 x 2^1 0 x 2^0
2210
1 x 16 0 x 8 1 x 4 1 x 2 0 x 1
16 0 4 2 0
16 + 0 + 4 + 2 + 0 =
Binary to decimal conversion
CONVERSION
Eg 2: Convert the number 101102 to the
decimal
9
20. Eg 2 :Convert the binary number 1011100 2
to decimal number
Solution:
Hence, 1 011 100 2 = 92
1 0 1 1 1 0 0
1 x 2^6 0 x 2^5 1 x 2^4 1 x 2^3 1 x 2^2 0 x 2^1 0 x 2^0
9210
1 0 1 1 1 0 0
1 x 64 0 x 32 1 x 16 1 x 8 1 x 4 0 x 2 0 x 1
64 + 0 + 16 + 8 + 4 + 0 + 0
=
Binary to decimal conversion
CONVERSION
Eg 3: Convert the number 10111002 to the
decimal
10
22. 16
16
16
1341
83
5
0
---- 3
---- 5
Eg 1: Convert the decimal number 1341 to
hexadecimal number
Hence,1341 = 53D16
Decimal to hex conversion
Hex Number
Write from bottom to
top → left to right
---- 13 = D
12
23. Eg 2 : Convert the decimal number 860 to
hexadecimal number
16
16
16
860
53
3
0
---- 12 = C
---- 5
---- 3
Hence, 860 = 35C16
Hex Number
Decimal to hex conversion
Write from bottom to
top → left to right
13
24. 16
16
16
2020
126
7
0
---- 4
---- 14 = E
---- 7
Eg 3 : Convert the decimal number 2020 to
hexadecimal number
Hex Number
Decimal to hex conversion
Hence, 2020 = 7E416
Write from bottom to
top → left to right
14
26. to decimal number● Convert
AFB216
Solution:
Hence, AFB216 =
44978
Eg 1 : Convert the hex number, AFB216
to decimal number
A F B 2
A x 16^3 F x 16^2 B x 16^1 2 x 16^0
4497810
10 x 4096 15 x 256 11 x 16 2 x 1
40960 + 3840 + 176 + 2 =
hex to decimal conversion
CONVERSION
Eg 1: Convert the number AFB16 to the
decimal
16
27. to decimal number● Convert
BA816
Solution:
Hence, BA816 =
2984
Eg 2 : Convert the hex number, BA816
to decimal number
B A 8
B x 6^2 A x 16^1 8 x16^0
298410
11 x 256 10 x 16 8 x 1
2816 + 160 + 8 =
hex to decimal conversion
CONVERSION
Eg 2: Convert the number BA816 to the
decimal
17
28. to decimal number● Convert AFFA16
Solution:
Hence, AFFA16 =
45050
Eg 3 : Convert the hex number, AFFA16
to decimal number
A F F A
A x 16^3 F x 16^2 F x 16^1 A x16^0
4505010
10 x 4096 15 x 256 15 x16 10 x
1
40960 + 3840 + 240 + 10 =
hex to decimal conversion
CONVERSION
Eg 3: Convert the number AFFA16 to the
decimal
18
30. Binary to Hexadecimal conversion
● There are two ways on how to convert
the
binary to hexadecimal number.
● 1st way : Decimal
Hexadecimal
○ Binary
○ 2nd way :
○ Binary Hexadecimal
binary to hex conversion 20
31. Eg. 1: Convert the binary number 110102 to
hexadecimal 1st way
○ Binary Decimal
26
1
16
16
0
---- 10 = A
---- 1
Decimal Hexadecimal
Hence, 11010 2 = 1A16
1 1 0 1 0
1 x 2^4 1 x 2^3 0 x 2^2 1 x 2^1 0 x 2^0
26
1 x16 1 x8 0 x 4 1 x 2 0 x 1
16 + 8 + 0 + 2 + 0 =
Eg. 1: Convert the binary number 110102 to
hexadecimal 1st way
21
32. ● Step 1: divide the given binary digit into 4 digit per
group from right to left.
1 1 0 1 0
● Step 2: Using 8421 table,
1 1 0 1 0
1
= 1
8 4
2
1
8 + 2
= 10
= A
8 4 2 1
Hence, 11010 2 =
1A16
Eg. 1: Convert the binary number 110102 to
hexadecimal 2nd way
22
33. Binary Decimal
binary to hex conversion
18
1
0
---- 2
---- 1
Decimal
16
16
Hexadecimal
Hence, 100102 = 1216
Hex number
Eg.2 :Convert the binary number 100102 to
hexadecimal 1st way
1 0 0 1 0
1 x 2^4 0 x 2^3 0 x 2^2 1 x 2^1 0 x 2^0
18
1 x 16 0 x 8 0 x 4 0 x 2 0 x 1
16 + 0 + 0 + 2 + 0 =
Eg. 2: Convert the binary number 100102 to
hexadecimal 1st way
23
34. Eg.2 :Convert the binary number 100102 to
hexadecimal 2nd way
● Step 1: divide the given binary digit into 4 digit per
group from right to left.
1 0 0 1 0
● Step 2: Using 8421 table,
1 0 0 1 0
1
= 1
8 4
2
1
2
= 2
8 4 2 1
Hence, 11010 2 =
1216
24
36. Hexadecimal to Binary conversion
● There are two ways on how to convert
the
hexadecimal to binary number.
● 1st way : Decimal
Binary
○ Hexadecimal
○ 2nd way :
○ Hexadecimal Binary
binary to hex conversion 26
37. Eg 1: Convert the hexadecimal number
3FD to binary number 1st way
Hexadecimal Decimal
16^2 16^1 16^0
1021
3 F D
256 x3 16 x15 1 x 13
768 + 240 + 13 =
hex to binary conversion
Eg. 1: Convert the hexadecimal number
3FD16 to binary number 1st way
Hexadecimal Decimal
27
38. Binary number
De
2
2
2
2
1021
510 ---- 1
255 ---- 0
127 ---- 1
2 63 ---- 1
2 31 ---- 1
2 15 ---- 1
2 7 ---- 1
2 3 ---- 1
2 1 ---- 1 Hence, 3FD16 = 11111111012
0 ---- 1
cimal Binary
hex to binary conversion
Eg. 1: Convert the hexadecimal number
3FD16 to binary number 1st way
28
39. Eg 1: Convert the hexadecimal number
3FD to binary number 2nd way
Hence, 3FD16 = 11111111012
=8+4+1
= 13
=8+4+2+1
= 15
=2+1
= 3
3 F = 15 D = 13
3 15 13
8 4 2 1 8 4 2 1 8 4 2 1
0 0 1 1 1 1 1 1 1 1 0 1
Eg. 1: Convert the hexadecimal number
3FD16 to binary number 2nd way
hex to binary conversion
29
40. Eg 2: Convert the hexadecimal number 1A2
to binary number 1st way
hex to binary conversion
Hexadecimal Decimal Decimal Binary
2
2
2
2
2
2
2
2
2
2
---- 0
---- 1
---- 0
---- 0
---- 0
---- 1
---- 0
---- 1
---- 1
Hence, 1A216 = 1101000102
1 A 2
1 x 16^2 A x 16^1 2 x 16^0
418
1 x 256 10 x 16 2 x 1
256 + 160 + 2 =
418
209
104
52
26
13
6
3
1
0
Eg. 2: Convert the hexadecimal number
1A216 to binary number 1st way
DecimalHexadecimal Decimal Binary
hex to binary conversion
30
41. Eg 2: Convert the hexadecimal number
1A2 to binary number 2nd way
=2=8+2
= 10
=1
Hence, 1A216 = 1101000102
1 A 2
1 10 2
8 4 2 1 8 4 2 1 8 4 2 1
0 0 0 1 1 0 1 0 0 0 1 0
= 2= 8 + 2
= 10
= 1
Eg. 2: Convert the hexadecimal number
1A216 to binary number 2nd way
hex to binary conversion
31
42. UPS 2015/2016
Q: Given the Internet Protocol address of a
printer as 192.0.0.2. Convert the address to
hexadecimal number [2 marks]
A: C0.0.0.2
32