0% found this document useful (0 votes)
15 views7 pages

Chapter 2 Number System and Encoding Scheme

Uploaded by

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

Chapter 2 Number System and Encoding Scheme

Uploaded by

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

Number System

Number system is the way to represent everything in the form of digits. There are four types of number
system.

1. Binary Number System


Binary number system can contain two digits 0 and 1. So base of binary number system is 2. Binary
numbers are represented with 2 as subscript to the value.
Examples of binary numbers are:

(1101)2, (1110.011)2
2. Decimal Number System
Decimal number system can contain digits from 0 to 9. So base of decimal number system is 10. Decimal
numbers are represented with 10 as subscript to the value.
Examples of decimal numbers are:

(1234)10, (55.34)10
3. Octal Number System
Octal number system can contain digits from 0 to 7. So base of octal number system is 8. Octal numbers are
represented with 8 as subscript to the value.
Examples of octal numbers are:

(561)8, (17.54)8
4. Hexadecimal Number System
Hexadecimal number system can contain digits from 0 to 9 and alphabets from A to F where where
A=10
B=11
C=12
D=13
E=14
F=15
So base of hexadecimal number system is 16. Hexadecimal numbers are represented with 16 as subscript to
the value.

Examples of hexadecimal numbers are:


(A74)16 , (91.B3)16

1
Number System Conversions

I. CONVERSION FROM DECIMAL TO OTHER NUMBER SYSTEMS.


Step 1: Divide the given number by the base value of the other number system(2, 8, 16) in
which it is to be converted.
Step 2: Note the Remainder.
Step 3: Keep on dividing the quotient by the base value and note the remainder till the
quotient is zero.
Step 4: Write the noted remainders in the reverse order(from bottom to top).

I(A). Decimal to Binary Conversion:


To obtain binary equivalent of a decimal number, decimal number should be repeatedly divided by 2 writing
remainder obtained at every step.
This should continue until last quotient is 1. The remainders should be written bottom to upwards to get
binary equivalent of decimal number.
Examples:
1. (17)10 = (?)2 = (10001)2

I(B). Decimal to Octal Conversion:


To obtain octal equivalent of a decimal number, decimal number should be repeatedly divided by 8 writing
remainder obtained at every step.
This should continue until last quotient is less than 8. The remainders should be written bottom to upwards
to get octal equivalent of decimal number.
Examples:

2
I(C). Decimal to hexadecimal Conversion:
To obtain hexadecimal equivalent of a decimal number, decimal number should be repeatedly divided
by 16 writing remainder obtained at every step.
This should continue until last quotient is less than 16. The remainders should be written bottom to
upwards to get hexadecimal equivalent of decimal number.

Examples:

II. CONVERSION FROM OTHER NUMBER SYSTEMS TO DECIMAL.


Step 1: Write the position number for each alphanumeric symbol in the given number.
Step 2: Get positional value for each symbol by raising its position number to the base-value
(2 or 8 or 16) symbol in the given number.
Step 3: Multiply each digit with the respective positional value to get a decimal value.
Step 4: Add all these decimal values to get the equivalent decimal number.

II (A). Binary to Decimal Conversion:


To obtain decimal equivalent of a binary number, individual digits of binary number should be multiplied by
powers of 2 starting with rightmost digit multiplied by 20, second last digit multiplied by 21, third last digit
multiplied by 22 and so on upto the leftmost digit.

Example:

II (B). Octal to Decimal Conversion:


To obtain decimal equivalent of an octal number, individual digits of octal number should be multiplied by
powers of 8 starting with rightmost digit multiplied by 80, second last digit multiplied by 81, third last digit
multiplied by 82 and so on upto the leftmost digit.

Example:

3
II (C). Hexadecimal to Decimal Conversion:
To obtain decimal equivalent of a hexadecimal number, individual digits of hexadecimal number should be
multiplied by powers of 16 starting with rightmost digit multiplied by 160, second last digit multiplied by
161, third last digit multiplied by 162 and so on upto the leftmost digit.

In case of alphabets A to F, codes of alphabets should be multiplied by power of 16.


Examples:

III. CONVERSION FROM BINARY TO OCTAL AND HEXADECIMAL & VICE-VERSA.


Step 1: A binary number is converted to octal or hexadecimal number by making a group by
3 & 4 bits, respectively.
Step 2: Replacing each group by its equivalent octal/hexadecimal digit.

III (A). Binary to octal Conversion:


To obtain octal equivalent of a binary number, digits of binary number should be divided into groups of
three digits starting from the right most digit. Then these groups should be converted into corresponding
octal digits.
Example:
To get octal equivalent of binary number
101011 we can take following steps:
101011 is divided into groups of
three digits as: (101)(011)
Octal equivalent of 011 is 3
Octal equivalent of 101 is 5
Octal equivalent of 1010112 is:

III (B). Octal to Binary Conversion:


To obtain binary equivalent of an octal number, individual digits of octal number should be converted to
binary in groups of three digits. (refer the table 2.5)
Example:
To get binary equivalent of octal number 127 we can take following steps:
Binary equivalent of 7 is 111
Binary equivalent of 2 is 010
Binary equivalent of 1 is 001
So Binary equivalent of (127)8 is:

4
III (C). Binary to Hexadecimal Conversion:
To obtain hexadecimal equivalent of a binary number, digits of binary number should be divided into groups
of four digits starting from the rightmost digit. Then these groups should be converted into corresponding
decimal numbers.

Example:
To get octal equivalent of binary number 1011101011 we can take following steps: 1011101011 is divided
into groups of four digits as: (0010)(1110)(1011)
Note: zeros are filled at the beginning of left most group of binary digits if there are lesser number of digits
than four.

Decimal equivalent of 1011 is 11 (B)


Decimal equivalent of 1110 is 14 (E)
Decimal equivalent of 0010 is 2
Hexadecimal equivalent of 10111010112 is:

III (D) Hexadecimal to Binary Conversion:


To obtain binary equivalent of a hexadecimal number, individual digits of hexadecimal number should be
converted to binary in groups of four digits.

Example:
To get binary equivalent of hexadecimal number
A27 we can take following steps:
• Binary equivalent of 7 is 0111
• Binary equivalent of 2 is 0010
• Binary equivalent of A(10) is 1010

So Binary equivalent of (A27)16 is:

IV. OCTAL TO HEXADECIMAL AND VICE-VERSA:

IV (A). Octal to Hexadecimal Conversion:


While converting from octal to hexadecimal unit,
1. Convert the octal number into binary digit (refer table 2.5)
2. Further convert binary to hexadecimal by forming the group of 4 binary bits to obtain its
hexadecimal equivalent,

Example:
To convert the number 536 from octal to hexadecimal.
1. Convert 536(octal) into its binary equivalent we get
(536)8 = (101) (011) (110)=(101011110)2
2. Now forming the group of 4 binary bits to obtain its hexadecimal equivalent,
(101011110)2= (0001) (0101) (1110)= (15E)16
So the hexadecimal number of 536 is 15E.

5
IV (B). Hexadecimal to Octal Conversion:
The hexadecimal number comprises of binary digits. Combine these binary digits in the pairs of three and
relate them to the octal numbers.

The steps involved in this method are given below.


1. For every given hexadecimal number’s digit, note down the number equivalent to the binary
number. Add 0’s to the left side, if any of the binary equivalents are less than 4 digits.
2. Next, combine the numbers and make the groups of binary digits from right to left, each
containing 3 digits. In case there are less than 3 digits in the last group, add 0’s to the group.
3. Find the value equivalent to the octal numbers of each binary group.

Example1: Convert the following hexadecimal number to octal number 2CD16.


Answer: Given, 2CD16 is a hexadecimal number.
2 → 0010, C →1100, D → 1101,
Now you will be grouping them from right to left, each having 3 digits.
(001) (011) (001) (101)
001→1, 011 →3, 001→1, 101→5

Hence, 2CD16 = 13158

Example2: Convert 1BC16 into an octal number.


Solution: Given, 1BC16 is a hexadecimal number.
1 → 0001, B → 1011, C →1100
Now group them from right to left, each having 3 digits.
(000) (110) (111) (100)
000→0, 110 →6, 111→7, 100→4 Hence,
1BC16 = 6748

Encoding Schemes/ String representation


String is any finite sequence of characters. Any string includes letters, numerals, symbols and punctuation
marks.

Computers are designed to work internally with numbers. To handle characters, we need to choose a number
for each character. There are many ways to do this ,which are knows as encoding schemes

Following are some Encoding schemes


• ASCII
• UNICODE
• ISCII

ASCII:It is most common coding system (Pronounced ass-key).

ASCII stands for American Standard Code for Information Interchange.


It is Defined in ANSI document X3.4-1977.
It is a 7-bit code.
Its 8th bit is unused (or used for a parity bit).
Two general types of codes:
6
o 95 are “Graphic” codes (displayable on a console)
o 33 are “Control” codes (control features of the console or communications channel)

ISCII
ISCII stands for Indian Script Code for Information Interchange for Indian languages.

It is an 8-bits code to represent Indian scripts.


The Department of Electronics (DOE) has established standard and standard are in action from 1983.
These codes are used for 10 Indian scripts- Devanagri, Punjabi, Gujrati, Udia, Bengali, Asami, Telgu,
Kannada, Malayalam and Tamil. C-DAC (established in August-September, 1988)
Developed standard for font coding in 1990 is called ISFOC (Indian Standards for Font Coding).

UNICODE (Universal Character Encoding Standard.)


• A standard called UNICODE has been developed to incorporate all the characters of every written
language of the world.
• UNICODE provides a unique number for every character, irrespective of device (server, desktop,
mobile), operating system (Linux, Windows, iOS) or software application (different Rationalised
2023-24 30 Computer Science – Class xi browsers, text editors, etc.).
• Commonly used UNICODE encodings are UTF-8, UTF-16 and UTF-32.
• It is a superset of ASCII, and the values 0–128 have the same character as in ASCII.

VARIOUS UNICODE ENCODING


1. UTF-8( Unicode Transformation Format – 8-bit.)
It is most popular type of Unicode encoding.
• It uses one byte for standard English letters and symbols, two bytes for additional Latin and
Middle Eastern characters, and three bytes for Asian characters. Any additional characters can be
represented using four bytes.
• It is backwards compatible with ASCII, since the first 128 characters are mapped to the same
values.

[Link]-32
• It is a multi-byte encoding that represents each character with 4 bytes
• Makes it space inefficient
• Its main use is in internal APIs(Application Programming Interface) where the data is single
code points or glyphs, rather than strings of characters
• Used on Unix systems sometimes for storage of information

Eg:
It is a fixed length encoding scheme that uses exactly 4 bytes to represent all Unicode code points. Letter
‘A’[U+41]

You might also like