12
STD :- XI AC 2. NUMBER SYSTEM NS-CS - lesson-2 Introduction :- DATA :- Data comes from the latin word ' Datum' which means 'something given'. Data is a collection of raw facts and figures . Data is used as input for the computer system. It is meaningless Data can be the following form 1.text [ letters]and 2.numbers[ 0-9] send through keyboard ,3. Images through scanner 4.Audio through microphone and 5.video through camera. The amount of data that can be stored in storage unit that in which storage capacity is expressed in terms of bytes. DATA REPRESENTATION :- The amount of data that can be stored in the storage unit that in which storage capacity is expressed in terms of bytes. BIT:- Binary digit :0/1.A group of bits in a computer are used to represent many different things. It can represent a number It can represent a character It can represent an instruction Byte is the basic unit of computer's memory. Main memory and secondary memory is normally represented in terms of kilobyte ,megabyte. The speed of the memory depends on the number of bits it can process at once. 1 Bit = 0 or 1 4 Bits = 1 NibblE 8 Bits = 1 Byte 1024 byte = 1 kilobyte 1024 kilobyte=1 Megabyte 1024 megabyte = 1Gigabyte 1024 gigabyte= 1Terabyte 1024 Terabyte = 1 Petabyte 1024 Petabyte = 1 Exabyte 1024 Exabyte= 1 Zettabyte 1024 Zettabyte = 1 Yottabyte Namma Kalvi www.nammakalvi.org J.B.A.S BOYS SCHOOL

J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

STD :- XI AC 2. NUMBER SYSTEM NS-CS - lesson-2

Introduction :-

DATA :-

Data comes from the latin word ' Datum' which means 'something given'.

Data is a collection of raw facts and figures .

Data is used as input for the computer system.

It is meaningless

Data can be the following form 1.text [ letters]and 2.numbers[ 0-9] send

through keyboard ,3. Images through scanner 4.Audio through

microphone and 5.video through camera.

The amount of data that can be stored in storage unit that in which

storage capacity is expressed in terms of bytes.

DATA REPRESENTATION :-

The amount of data that can be stored in the storage unit that in which

storage capacity is expressed in terms of bytes.

BIT:-

Binary digit :0/1.A group of bits in a computer are used to represent

many different things.

It can represent a number

It can represent a character

It can represent an instruction

Byte is the basic unit of computer's memory.

Main memory and secondary memory is normally represented in terms

of kilobyte ,megabyte.

The speed of the memory depends on the number of bits it can process

at once.

1 Bit = 0 or 1

4 Bits = 1 NibblE

8 Bits = 1 Byte

1024 byte = 1 kilobyte

1024 kilobyte=1 Megabyte

1024 megabyte = 1Gigabyte

1024 gigabyte= 1Terabyte

1024 Terabyte = 1 Petabyte

1024 Petabyte = 1 Exabyte

1024 Exabyte= 1 Zettabyte

1024 Zettabyte = 1 Yottabyte

Namma Kalviwww.nammakalvi.org

J.B.A.S BOYS SCHOOL

Page 2: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

NUMBER SYSTEM :-

A set of values used to represent different quantities is known as

number system. Eg; A number can be used to represent the number of

students in a class.

or A numbering system is a way of representing numbers.

TYPES OF NUMBER SYSTEM :-

1. Positional number system

2.Non-positional number system

* POSITIONAL NUMBER SYSTEM:-

It uses only a few symbols called digits.

These symbols represent different values depending on the position

they occupy in the number.

* NON-POSITIONAL NUMBER SYSTEM:-

It uses symbols such as I for 1,II for 2 etc

Each symbol represents the same value regardless of its position in

the number.

The symbols are simply added to find out the value of a particular

number.

DIFFERENT TYPES OF NUMBER SYSTEM:-

A numbering system is a way of representing numbers.each number

system is uniquely identified by its base value or radix.Base is the count of

number of digits in each number system.The most commonly used

numbering system in real life is decimal number system.

Decimal number system -Base 10

Binary number system - Base 2

Octal number system - Base 8

Hexa decimal number system -Base 16

I.DECIMAL NUMBER SYSTEM:-

Characteristics:-

It uses ten digits from 0 to 9.

Also known as base ten number system

Each position in decimal number represents a 0 power of the base 10.

example; 1897

It can be written as =1*1000+ 8 * 100+9*10+7

= 1000+800+90+7

= 1897

Structure:

Decimal no........ ....d3 d2 d1 d0 d-1 d-2.........

positional weights 103 102 101 100 10-1 10-2.........

2.BINARY NUMBER SYSTEM:-

Characteristics:-

It uses two digits 0 and 1

Also called as base 2 number sytem

www.nammakalvi.org

Page 3: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

Each position in a binary represents a 0 power of the base 2.

Structure;

Base no ....................b3 b2 b1 b0 b-1 b-2

positional weights...23 22 21 20 2-1 2-2

Binary arithmetic:-

1.Binary addition:- RULES: 0+0 = 0

0+1 = 1

1+0 = 1

1+1 = 0 with carry 1

example: 0011010+001100

0011010

+ 0001100

0100110

2. Binary subtraction:- RULES: 0-0 = 0

1-0 = 1

1-1 = 0

0-1 = 1 borrow

example; - 0011010 - 001100

11 borrow

0011010

- 001100

0001110

3. Binary multiplication:- RULES ; 0*0 =0

0*1 = 0

1*0 =0

1*1 =1

example:- 0011010 * 001100

0011010

* 0001100

0000000

0000000*

0011010**

0011010***

0100111000

Page 4: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

4.Binary division :

example: 101010/ 110

0001011

110 101010

-0

10

- 0

101

- 0

1010

- 110

1001

- 110

0110

- 110

0

Binary number representation:- There are two groups.Signed numbers and

unsigned numbers.

Signed numbers:-

signed numbers contain both sign and magnitude of the number.

generally the sign is placed infront of number.

so we have consider the positive sign for positive numbers and negative

sign for negative numbers

Unsigned numbers:-

It contains only magnitude of the number.

they don't have any sign that means all unsigned binary numbers are

positive.

Representation of signed binary numbers:-

0 0 1 1 1 0 1

The left most bit in the binary number is called as most significant bit.

It has the largest positional weight.

The most significant bit of signed binary number is used to indicate the

sign of the numbers.

Hence it is called as sign bit or parity bit.

Page 5: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

The simplest method to present negative binary number is called signed

magnitude.

The right most bit is the least significant bit and has the smallest

positional weight.

Three types of representation of signed numbers:-

signed magnitude

1's compliment

2's complement

Representation of positive number in all these three form is same.but only

the representation of negative number will differ in each form.

Signed magnitude:-

In signed binary representation , the left most bit is considered as sign bit.

if this bit is 0,it is a positive number and if it is 1 , it is a negative

number.Therefore a signed binary number has 8 bits ,only 7 bits used for

storing values ( magnitude ) and the 1 bit is used for sign.

Eg: +43 or 43 is a positive number

- 43 is a negative number

2 43

2 21-1

2 10-1

2 5-0

2 2-1

1-0

+43 is represented in memory as

0 0 1 0 1 0 1 1

0's represents that the number is positive

-43 can be represented as in memory as

1 1 0 1 0 1 0 1

1' represent that the number is negative

1'S Complement form:

The 1's complement of a numberis obtained by complementing all the bits

of signed binary number .so 1's complement of positive number gives a

negative number .similarly 1's complement of negative number gives a

positive number.

steps for 1's complement:-

convert decimal number into binary number

check if the binary number contains 8 bits , if less add 0 at the left

most bit to make it as 8 bits

invert all bits( change 0 as 1 , 1 as 0 )

Eg:- ( -24)10

Page 6: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

2 24

2 12-0

2 6-0

2 3-0

2 1-1

given number (- 24)10

binary number 00011000

1's complement 11100111

The 2's complement of a binary number is obtained by ading one to the 1's

complement of signed binary numbers.

steps for 2's complement:-

Invert all the bits in the binary sequence ( i.e change 0 to 1 and 1 to 0)(i.e

1's complement)

add 1 to the result to the least significant bit.

Eg:- 2's complement of ( - 24 )10

binary equivalent of + 24 = 11000

8 bit format = 00011000

1' s complement= 11100111

add 1 to LSB = + 1

2'S Complement of -24 = 11101000

DIFFERENCE BETWEEN 1'S COMPLEMENT AND 2'S COMPLEMENT:-

1'S complement 2's complement

It has two representations of 0 which is positive 0 and 1 which is negative 0

Only one representation for 0 because if we add 1 to 11111 (-1 ) we get 0000 (+0) which is the same as positive zero

While adding numbers using 1's complement we first do binary addition ,then add in an end around carry value

But 2's complement has only one value for 0 and doesn't require carry values.

Number system conversions:-

1. Decimal to binary conversion:-

two methods.

method :1 - repeated division by 2.

Any decimal number divided by 2 will leave a remainder of 0 or 1.

Repeated division by 2 will leave a sequence of 0s and 1s that

become the binary equivalent of the decimal number.

Eg: ( 65 )10

2 65

2 32-1

www.nammakalvi.org

Page 7: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

2 16-0

2 8-0

2 4-0

2 2-0

1-0

( 65 ) 10 = ( 100001 )2

Method : 2 sum of powers of 2 Eg:- ( 36 ) 10

find the largest power of 2 that is smaller than or equal to 36

36 > 32

set the 32's bit to 1 and subtract 32 from the original number

36-34 = 4

16 is greater than the remaining total.therefore set the 16's

bit to 0

8 is greater than the remaining total .hence set the 8 'sbit to 0

as the remaining value is itself in powers 2. set 4's bit to 1 and

subtract 4.

4-4 = 0

conversion is complete when there is nothing to left to

subtract.

( 36 )10 = ( 100100 )2

32 16 8 4 2 1

1 36-34=4

32 16 8 4 2 1

1 0 0 1 4-4=0

32 16 8 4 2 1

1 0 0 1 0 0 36 = 100100

2. Fractional decimal to binary:-

multiply the decimal fraction by 2 and note the integer part.

the integer part is either 0 or 1

discard the integer part of previous product . multiply the

fractional part of the previous product by 2.

Repeat step 1 until the same fraction repeats or ends 0.

The resulting integer part forms a sequence of 0s and 1s that

become the binary equivalent of decimal fraction.

Eg :- ( 98. 46 )10

2 98

2 49-0

Page 8: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

2 24-1

2 12-0

2 6-0

2 3-0

1-1

MULTIPLICATION[ INTEGER ] FRACTION

.46 * 2 = 0.92 0 .92

.92 * 2 = 1.84 1 .84

.84 *2 = 1.68 1 .68

.68 * 2 = 1.36 1 .36

.36 * 2 = 0.72 0 .72

.72 *2 = 1.44 1 .44

.44 * 2 = 0.88 0 .88

.88 * 2 = 1.76 1 .76

.76 *2 = 1.52 1 .52

( 98.46 )10 = ( 1100010.011101011........... )2

3. Binary to decimal conversion:-

steps:-

write down the binary digits and list the powers of 2 from right to

left

Eg ( 111011 )2 = 25 24 23 22 21 20

1 1 1 0 1 1

for each positional notation written for the digit, now write the

equivalent weight

25 24 23 22 21 20

32 16 8 4 2 1

multiply each digit with its corresponding weight

32 *1 + 16 *1 +8 *1+4*0 + 2* 1 +1 *1

32 + 16 +8 +0 + 2 +1 = 59

( 111011 )2 = ( 59 ) 10

4. FRACTIONAL BINARY TO DECIMAL:-

a. Convert integer part of binary to decimal equivalent using

positional notation method

b. to conv ert the fractional part of binary to its decimal equivalent

c. write down the binary digits in the fractional part

d. for all the digits write powers of 2 from left to right starting from

2-1 , 2-2, 2-3 ......... ,now write the equivalent weight

2-1= 21/2 = 0.5 , 2-2 = 21/4 =0.25 , 2-3= 21/8 = 0.125 ...........

e. multiply each digit with its corresponding weight

f. add all the values which you obtained in step e

g. to get final answer write the integral part folowed by a decimal

point 21202-12-22-3

Eg:- ( 11. 011 )2 1 1 . 0 1 1

Page 9: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

1 * 21 + 1*20 = 3 . 0*0.5 + 1 *0.25 +1 *0.125 = 375

( 11.011)2 = ( 3.375 )10

iii. OCTAL NUMBER SYSTEM:-

Characteristics:

uses eight digits

also called as base 8 number system

each position in an octal number represents a 0 power of the

base 8.

a.Conversion of octal to binary:-

convert each octal digit to a 3-digit binary number

combine all the binary

Eg:- ( 25 ) 8 210 510

(010)2 ( 101 )2

( 25 ) 8 = ( 010101 )2

b. Conversion of binary to octal:-

divide the binary digits into groups of three ( starting from right )

convert each group of three binary digits to one octal digit

Eg:- 101110101

1 0 1 = 1 *20= 1, 0 *21=0, 1 *22= 4 (1 +0+4 ) = 5

1 1 0 = 0 *20=0, 1 *21 =2, 1 *24 = 4 ( 0+2+4) = 6

101 = 1 *20= 1,0 *21= 1, 1*22= 4 ( 1+0+4 ) = 5

( 101110101 )2 = (565)8

c. Conversion of decimal to octal:-

to convert decimal to octal repeated division by 8 method can be

used

Eg:- ( 65 ) 10

8 65

8 8-1

1-0

( 65 ) 10 = ( 101 )8

d. conversion of octal to decimal number:-

write down the octal digits and list the powers of 8 from right to left

for each positional notation of the digit write the equivalent weight

multiply each digit with its corresponding weight

add all the values

Eg:- ( 1265 ) 8

1 2 6 5

83 82 81 80

512 64 8

= 1*512 + 2 * 64 + 6 * 8 + 5 *1

www.nammakalvi.org

Page 10: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

=512+128+48+5

=693

( 1265 )8 = ( 693 )10

IV. HEXADECIMAL NUMBER SYSTEM:-

Uses 10 digits and 6 letters i.e 0,1,2,.........9,A,B,C,D,E,F

Letters represent the numbers starting from 10

A=10,B=11,C=12,D=13,E=14,F=15

Also called as base 16 number system

each position in a hexadecimal number represents a 0 power of the base

16.

conversion of hexadecimal to binary:-

write 4 bits binary equivalent for each hexadecimal digit for the given

number using positional notation method.

Eg:- 8 BC

2 8 B=11 2 11 C= 12 2 12

2 4-0 2 5-1 2 6-0

2 2-0 2 2-1 2 3-0

1-0 1-0 1-1

8=1000 B= 1011 C= 1100

( 8BC )16 = ( 100010111100 )2

Conversion of Decimal to hexadecimal :-

To convert decimal to hexadecimal repeated division by 16 method can be

used

Eg:- ( 31 ) 10

16 31

1-15

Conversion of hexadecimal to decimal:-

write down the hexadecimal digits and list the powers of 16 from right

to left

for each positional notation written for the digit ,now write the equivalent

weight

multiply each digit with its corresponding weight

add all the values to get one final value

Eg:- ( 25 F )16

2 5 F=15

162 161 160

256 16 1

= 2*256 + 5 *16 + 15 * 1

=512+80+15

=607

Page 11: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

(25F )16 = (607 )10

Advantages of number system:-

The biggest advantages of binary number system is its simplicity.As

the switches used in computer language or either ON or OFF ,They

can be easily read with little possibilities of errror.

The main advantage of hexadecimal number is that it is very

compact also it is quick and easy to convert between hexadecimal

number and binary.

Disadvantages of number system:-

The main disadvantages of binary number is that the binary string

equivalent of a large decimal base 10 number can be quite long.

when working with large digital system such as computer it is

common to find binary number consisting of 8.16 and 2 digits which

makes it difficult to both read and write without producing errors

especially when working with lot of 16 or 32 bits binary number.

Application of number system:-

The most common application for the binary number system can be

found in computer technology.

All computer language and programming is based on the 2- digit

number systeem used in digital encoding.

BINARY CODE:-or REPRESENTING CHARACTERS IN MEMORY:-

Combination of bits to represent numbers,letters,or symbols are called as

binary codes or digital codes.

Coding system:-

The transformation of data or information from human

understandable form to machine understandable form is called as

ENCODING.

The transformation of data or information from machine

understandable form to human understandable form is called as

DECODING.

Classification of binary codes:-

Binary codes

weighted non-weighted sequential reflective Alpha numeric Error coding

and correcting

binary BCD Excess-3 Gray five bit BCD 8421 Excess-3 parity Hamming

2421 5211 Excess-3 ASCII EBCDIC Hollerith:

BCD :- Binary coded decimal :-

This is one of the earliest memory code

each decimal digit is represented by four bits

Page 12: J.B.A.S BOYS SCHOOL - nammakalvi.in · x multiply the decimal fraction by 2 and note the integer part. x the integer part is either 0 or 1 x discard the integer part of previous product

modern computers do not use BCD code since theycannot process

non-numeric data

for example 6 is represented as 0110

The devices such as electronic calculators ,digital clocks work with

BCD numbers

ASCII - American standard code for information interchange:-

pronounced as Ask-ee

it is also an alphanumeric code

it is the standardised alphanumeric code mostly used by computer

manufacturers.

initially it used seven bits and later it was extended to 8 bits .

it can handle 256 characters

in ASCII code, the 8 bits are divided into two 4 bit groups called zone

and numeric group.

The ASCII code equivalent to the upper case letter A IS 65 AND THE

BINARY REPRESENTATION OF ITS 01000001.

EBCDIC- Extended binary coded decimal interchange code:

it is also an alphanumeric code

This is similar to ASCII code with 8 bit representation

it is formulated by international business machine

it can handle 256 characters

The 8 bits are divided into two 4 bit groups.The left part called as

zone and the right part called as digital bit group

ISCII- Indian standard code for information interchange:-

This is a 8 bit coding system

formulated by the department of electronics in India in 1986

Recognized by Bureau of Indian standards

it can handle the character of Indian local languages

UNICODE:-

This coding system is used in the modern computers

Unicode uses 16 bits and it can represent 65536 characters

This code facilitates to represent characters of other languages like

Tamil,Greek, Chinese And Japanese in computers.

www.nammakalvi.org