You are on page 1of 24

COURSE CODE : CSC 201

Introduction to Computer Science

Topic: Data Storage and Internal Representation I

Week 3 – Module 1
DR(MRS) O.E.OJO

1
• The Concept of Data
• Internal Representation
- Binary System
- Octal Numbering System
- Hexadecimal Numbering

2
Types of Data

• Text
• Number
• Sound
• Image
• Video
3
`

4
Data Representation
• In digital system, numerical information is
usually represented in binary form.
• The binary form is with digits 0 and 1 called a
bit.
• Bit is an acronym for binary digit.
• A bit is the smallest piece of information that
can be stored and manipulated in a computer.
• When bits are organised into larger units they
are called byte.
5
6
7
Conversion from base 10 to base 2
2 58
2 29 r 0
2 14 r 1
2 7 r 0
2 3 r 1
2 1 r 1
2 0 r 1

5810 = 1110102
8
• Convert 0.85937510 to the corresponding binary
0.859375
X 2
1 .718750
X 2
1 .437500
X 2
0 .875000
X 2
1 .750000
X 2
1 .500000
X 2
1 .000000
0.85937510 = 0.1101112

9
Conversion from base 2 to 10
• Convert 101112 to base 10
Solution: 1 0 1 1 1
4 3 2 1 0 Digit Position

L R
101112 = 1 x 24 + 0 x 23 + 1 x 22 + 1 x 21 + 1 x 20

= 16 + 0 + 4 + 2 + 1 = 2310


10
Convert 1101.00112 to Base 10
Solution:

1 1 0 1 . 0 0 1 1
3 2 1 0 -1 -2 -3 -4

1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 . 0 x 2-1 +

0 x 2-2 + 1 x 2-3 + 1 x 2-4

= 8 + 4 + 0 + 1 . 0 + 0 + 0.125 + 0.0625

1101.00112 = 13.187510 11
Octal Numbering System
- They are numbers in base eight
- Takes some eight numbers between 0 – 7
- ease of conversion
- Can be used as short hand for binary
numbers

12
Conversion table for Octal System
Decimal Binary representation in Octal
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111

13
The digit position in octal form is
8 8 8 . 8 8 8
2 1 0 -1 -2 -3 Digit Position

Convert 4238 to decimal


4 2 38
2 1 0

= 4 x 82 + 2 x 81 + 3 x 80
= (4 x 64) + 2 x 8 + 3 x 1
= 256 + 16 + 3

423 = 275 14
Convert 24.68 to binary
• NB: steps involved
• (i) convert to base 10
• (ii) then convert to binary

• 2 x 81 + 4 x 80 . 6 x 8-1
• 16 + 4 . 6/8 = 20.7510
15
(ii) Convert 20.7510 to binary
2 20
2 10 r 0
2 5 r 0
2 2 r 1
2 1 r 0
2 0 r 1

16
• Ans: 24.68 = 10100.112
0.7510 to 2
0. 7 5
X 2
1. 5 0
X 2
1. 0 0
17
Convert 21610 to octal

8 216
8 27 r 0
8 3 r 3
8 0 r 3
21610 = 3308
18
19
Base 10 To Hexadecimal
Convert 13210 to hexadecimal

16 132
16 8 r 4
16 0 r 8
13210 = 8416 or 84h
20
Convert 84h to decimal
1 0
8 x 16 + 4 x 16

= 128 +4

= 13210
21
Convert 2AFh to base 10
2 1 0
(2 x 16 ) + A x 16 ) + (F x 16 )

= 2 x 256 + 10 x 16 + 15 x 1

= 512 +160 + 15

2AFh = 68710
22
Hexadecimal to binary
9A2h to binary
9 = 10012
A= 10102
2 = 00102
9A2h = 1001101000102
23
Convert B2Fh to Octal
B2Fh

B =10112

2 =00102

F = 11112

B2Fh= 101 100 101 1112 = 54578

24

You might also like