0% found this document useful (0 votes)
54 views20 pages

Data Representation in Number Systems

Here are the conversions between number systems as requested: 1. a. 12 b. 3 c. 28 d. 60 e. 42 2. a. 10000 b. 0110 c. 0111111 d. 1001001 e. 1111111 3. c. 10 b. 1535 c. 1775776 d. 4742424 e. 2355455 4. d. 12 b. 159 c. 3,370 d. 1,666 e. 43,981 5. a. 10 b. 50 c. A00 d. BC0 e. FEA0

Uploaded by

Huma Iqrar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views20 pages

Data Representation in Number Systems

Here are the conversions between number systems as requested: 1. a. 12 b. 3 c. 28 d. 60 e. 42 2. a. 10000 b. 0110 c. 0111111 d. 1001001 e. 1111111 3. c. 10 b. 1535 c. 1775776 d. 4742424 e. 2355455 4. d. 12 b. 159 c. 3,370 d. 1,666 e. 43,981 5. a. 10 b. 50 c. A00 d. BC0 e. FEA0

Uploaded by

Huma Iqrar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Computer Organization & Assembly

Language
2 – Data Representation
Number System
• Any number system using a range of digits that represents a
specific number. The most common numbering systems are
decimal, binary, octal, and hexadecimal.
• Numbers are important to computers
• represent information precisely
• can be processed

• For example:
• to represent yes or no: use 0 for no and 1 for yes
• to represent 4 seasons: 0 (autumn), 1 (winter), 2(spring) and 3
(summer)

2
Number System
• A computer can understand number system where there are
only a few symbols called digits and these symbols represent
different values depending on the position they occupy in the
number.

• A value of each digit in a number can be determined using


• The digit
• The position of the digit in the number
• The base of the number system (where base is defined as
the total number of digits available in the number system).

3
Decimal Number System

For example
Unit
Tens
Hundred
Thousands

4
Binary Number System

5
Hexadecimal Number System

6
Conversion Between Number Systems
• Converting Hexadecimal to Decimal
• Multiply each digit of the hexadecimal number from right to
left with its corresponding power of 16.
• Convert the Hexadecimal number 82ADh to decimal number.

7
Conversion Between Number Systems
• Converting Binary to Decimal
• Multiply each digit of the binary number from right to
left with its corresponding power of 2.
• Convert the Binary number 11101 to decimal number.

8
Conversion Between Number Systems
• Converting Decimal to Binary
• Divide the decimal number by 2.
• Take the remainder and record it on the side.
• REPEAT UNTIL the decimal number cannot be divided
into anymore.

9
Conversion Between Number Systems
• Converting Decimal to Hexadecimal
• Divide the decimal number by 16.
• Take the remainder and record it on the side.
• REPEAT UNTIL the decimal number cannot be divided into anymore.

10
Conversion Between Number Systems
• Converting Hexadecimal to Binary
• Given a hexadecimal number, simply convert each digit to it’s binary equivalent. Then, combine each 4 bit
binary number and that is the resulting answer.

• Converting Binary to Hexadecimal


• Begin at the rightmost 4 bits. If there are not 4 bits, pad 0s to the left until you hit 4. Repeat the steps until all
groups have been converted.

11
Unsigned Integers

• An unsigned integer is an integer that represents magnitude, so it is


never negative.

• Unsigned integers are appropriate for representing quantities that can


be never negative.
• For example 0,1,2,3,…

12
Signed Integers

• A signed integer can be positive or negative.


• The left most bit is the signed bit
• If it is 1 the number represented is negative
• If it is 0 the number represented is positive or zero

13
MSB and LSB

• In computing, the most significant bit (MSB) is the bit position in a


binary number having the greatest value. The MSB is sometimes
referred to as the left-most bit.

• In computing, the least significant bit (LSB) is the bit position in a


binary integer giving the units value, that is, determining whether the
number is even or odd. The LSB is sometimes referred to as the right-
most bit.

14
Binary, Decimal, and Hexadecimal Equivalents.

Binary Decimal Hexadecimal Binary Decimal Hexadecimal

0000 0 0 1000 8 8

0001 1 1 1001 9 9

0010 2 2 1010 10 A

0011 3 3 1011 11 B

0100 4 4 1100 12 C

0101 5 5 1101 13 D

0110 6 6 1110 14 E

0111 7 7 1111 15 F
Character Representation
• All data, characters must be coded in binary to be processed by the
computer.
• ASCII:
• American Standard Code for Information Interchange
• Most popular character encoding scheme.
• Uses 7 bit to code each character.
• 27 = 128 ASCII codes.
• Single character Code = One Byte [7 bits: char code, 8th bit set to zero]
• 32 to 126 ASCII codes: printable
• 0 to 31 and 127 ASCII codes: Control characters

16
17
How to Convert?
• If a byte contains the ASCII code of an uppercase letter, what hex
should be added to it to convert to lower case?
• Solution: 20 h
• Example: A (41h) a (61 h)
• If a byte contains the ASCII code of a decimal digit, What hex should
be subtracted from the byte to convert it to the numerical form of the
characters?
• Solution: 30 h
• Example: 2 (32 h)

18
Character Storage
ASCII Representation of “123” and 123

'1' '2' '3'


"1 2 3" = 00110001 00110010 00110011

123
123 = 01111011

19
1. Convert the following binary numbers to their decimal equivalents:
a. 001100 b. 000011 c. 011100 d. 111100 e. 101010
2. Convert the following decimal numbers to their binary equivalents:
b. 64 b. 100 c. 111 d. 145 e. 255
3. Express the following octal numbers in hexadecimal notation:
c. 12 b. 5655 c. 2550276 d. 76545336 e. 3726755
4. Convert the following hexadecimal numbers to their decimal equivalents:
d. C b. 9F c. D52 d. 67E e. ABCD
5. Convert the following decimal numbers to their hexadecimal equivalents:
a. 16 b. 80 c. 2560 d. 3000 e. 62,500

You might also like