1 of 39

DATA REPRESENTATION

2 of 39

  • Computer works on 1’s and0’s , in other words data stored inside a computer gets stored in digital form.

  • 1 and 0 together constitute a bit, which is the smallest piece of information computer can store.

  • If there is a single wire, there exist the following states: ON/OFF, YES/NO, TRUE/FALSE, 1/0

3 of 39

1 wire = 2 combinations i.e 0,1

2 1 = 2

2 wires = 2 2 = 4

4 combinations i.e 00,01,10,11

3 wires = 2 3 = 8 combinations

4 of 39

number system :

  • Number systems are the technique to represent numbers in the computer system architecture.

  • When this data is fed to the computer it is converted to numeric format according to the ASCII

  • American Standard Code for Information Interchange

5 of 39

  • In digital number system are classified into digits

* Decimal System

* Binary System

* Octal System

* Hexadecimal System

6 of 39

  • Each digit in the number system depends upon :

i) Face value of digits

ii) Base of number system

iii) Position of number system

7 of 39

decimal number system

Decimal system has only 10 digits from 0 to 9

Base for Decimal is 10

Eg : The number 425 is represented as

400 + 20 + 5

4 x 102 + 2 x 101 + 5 x 100

8 of 39

decimal number system

Eg : The number 4791.83 is represented as :

= 4x103 + 7x102 + 9x101 + 1x100 + 8x10-1 + 3x10 -2

9 of 39

binary number system

Binary system has only 2 digits i.e 0 and 1.

The base for binary number is 2

So we will learn how to convert Decimal to Binary

Convert (29)10 to (X)2

10 of 39

(29)10 = (11101)2 οΏ½

11 of 39

Convert the following :

1. (43)10 to (X)2

12 of 39

Convert the following :

  1. (101)10 to (X)2
  2. (200)10 to (X)2
  3. (156)10 to (X)2
  4. (197)10 to (X)2
  5. (255)10 to (X)2

13 of 39

Convert the following :

  1. (101)10 to (X)2 - 1100101
  2. (200)10 to (X)2 - 11001000
  3. (156)10 to (X)2 - 10011100
  4. (197)10 to (X)2 - 11000101
  5. (255)10 to (X)2 - 11111111

14 of 39

7. (3.15)10 to (X)2

15 of 39

8. (14.625)10 to (X)2

16 of 39

8. (10.16)10 to (X)2

17 of 39

Convert binary to decimal

1 . (1100)2 to (X)10

1 x 23 + 1 x 22 + 0 x 21 + 0 x 20

8 + 4 + 0 + 0 = 12

Ans : (1100)2 to (12)10

18 of 39

Convert binary to decimal

  1. (10101)2 to (X)10
  2. (1100101)2 to (X)10
  3. (10101111)2 to (X)10
  4. (11100101)2 to (X)10

19 of 39

Convert binary to decimal

  1. (10101)2 to (X)10 - 21
  2. (1100101)2 to (X)10 101
  3. (10101111)2 to (X)10 175
  4. (11100101)2 to (X)10 229

20 of 39

Convert binary to decimal

4. (101.110)2 to (X)10

1 x 22 + 0 x 21 + 1 x 20 + 1 x 2-1 + 1 x 2-2 + 0 x 2-3

= 4 + 0 + 1 + 0.5 + 0.25 + 0

= 5.75

Ans : (101.110)2 to (5.75)10

21 of 39

2.(1010.0101) 2 ---(10.3125) 10

22 of 39

OCTAL NUMBER SYSTEM

  • Octal Number System has base 8

and numbers from (0 – 7)

Convert from decimal to octal

1. (125)10 to (X)8

23 of 39

2. (670)10 to (X)8οΏ½οΏ½οΏ½

24 of 39

2. (670)10 to (1236)8οΏ½

25 of 39

3. (0.218)10 to (x)8οΏ½

26 of 39

3. (0.218)10 to (x)8οΏ½

27 of 39

Decimal

Binary

Octal

Hexa decimal

28 of 39

4. (670)8 to (X)2

X

Y

Z

N

0

0

0

0

0

0

1

1

0

1

0

2

0

1

1

3

1

0

0

4

1

0

1

5

1

1

0

6

1

1

1

7

29 of 39

4. (670)8 to (X)2

  • 110111000

X

Y

Z

N

0

0

0

0

0

0

1

1

0

1

0

2

0

1

1

3

1

0

0

4

1

0

1

5

1

1

0

6

1

1

1

7

30 of 39

5. (347)8 to (X)2

6. (56.27)8 to (X)2

7. (101110)2 to (X)8

8. (1110)2 to (X)8

9. (10111.001)2 to (X)8

10. (10110110.0101)2 to (X)8

31 of 39

5. (347)8 to (X)2 011 100 111

6. (56.27)8 to (X)2 101110.010111

7. (101110)2 to (X)8 56

8. (1110)2 to (X)8 16

9. (10111.001)2 to (X)8 27.1

10. (10110110.0101)2 to (X)8 266.24

32 of 39

HEXADECIMAL NUMBER SYSTEM

  • A Hexadecimal system has 16 values from 0-9 and A-F.

  • 0 1 2 3 4 5 6 7 8 9 A B C D E F

33 of 39

A

B

C

D

N

0

0

0

0

0

0

0

0

1

1

0

0

1

0

2

0

0

1

1

3

0

1

0

0

4

0

1

0

1

5

0

1

1

0

6

0

1

1

1

7

1

0

0

0

8

1

0

0

1

9

1

0

1

0

A

1

0

1

1

B

1

1

0

0

C

1

1

0

1

D

1

1

1

0

E

1

1

1

1

F

34 of 39

convert the following

  1. (4AF)16 to (X)2

  • (101101.10)2 to (X)16

  • (BAD)16 to (X)8

  • (345)8 to (X)16

5. (179)16 to (X)10

35 of 39

convert the following

  1. (4AF)16 to (X)2 010010101111
  2. (101101.10)2 to (X)16 2D.8
  3. (BAD)16 to (X)8 5655
  4. (345)8 to (X)16 E5
  5. (179)16 to (X)10 377

36 of 39

BINARY ADDITION

  • ALU doesn’t directly work with decimal numbers, they work with binary numbers
  • There are 5 basic cases of binary addition

CASE 1 : 0 + 0 = 0

CASE 2 : 0 + 1 = 1

CASE 3 : 1+ 0 = 1

CASE 4 : 1 + 1 = 10 equals 0 with a carry 1

CASE 5 : 1 + 1 + 1 = 11 equals 1 with a carry 1

37 of 39

ADD THE FOLLOWING USING BINARY ADDITION

  1. 101 + 110

1 0 1

1 1 0

10 1 1

38 of 39

ADD THE FOLLOWING USING BINARY ADDITION

  1. 1011 and 110
  2. 15 + 27
  3. 01010111 and 00110101
  4. 11110 and 11
  5. 11.01 and 101.11

39 of 39

  1. 1011 and 110 - 10001
  2. 15 + 27 - 101010
  3. 01010111 and 00110101 - 10001100
  4. 11110 and 11 - 100001
  5. 11.01 and 101.11 - 1001.00