0% found this document useful (0 votes)
19 views

class 11 computer science ch-2 notes with questions an pyq

Uploaded by

lakshyaraj1444
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)
19 views

class 11 computer science ch-2 notes with questions an pyq

Uploaded by

lakshyaraj1444
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
You are on page 1/ 15

1

These notes are provided by studifysuccess.

Chapter-2 Encoding Schemes and


number systems

Introduction
The mechanism of converting data into an equivalent cipher using
specific code is called encoding.
When a key on the keyboard is pressed, it is internally mapped to a
unique code, which is further converted to binary.

Example 2.1 When the key ‘A’ is pressed (Figure 2.1), it is internally
mapped to a decimal value 65 (code value), which is then converted
to its equivalent binary value for the computer to understand.
2.1.1 American Standard Code for Information Interchange
(ASCII)
Encoding scheme ASCII was developed for standardising the
character representation. ASCII is still the most commonly used
coding scheme.
• ASCII value of D is 68 and its equivalent 7-bit binary code =
1000100
• ASCII value of A is 65 and its equivalent 7-bit binary code =
1000001

www.studifysuccess.com Made by Vrinda Rastogi


2
These notes are provided by studifysuccess.

• ASCII value of T is 84 and its equivalent 7-bit binary code =


1010100
• ASCII value of A is 65 and its equivalent 7-bit binary code =
1000001

www.studifysuccess.com Made by Vrinda Rastogi


3
These notes are provided by studifysuccess.

2.1.2 Indian Script Code for Information Interchange (ISCII)

In order to facilitate the use of Indian languages on computers, a


common standard for coding Indian scripts called ISCII was
developed in India during mid 1980s. It is an 8-bit code
representation for Indian languages which means it can represent
28=256 characters. It retains all 128 ASCII codes and uses rest of the
codes (128) for additional Indian language character set.

2.1.3 Unicode
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 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.
2.2 Number System
A number system is a method to represent (write) numbers. Every
number system has a set of unique characters or literals. The count
of these literals is called the radix or base of the number system

www.studifysuccess.com Made by Vrinda Rastogi


4
These notes are provided by studifysuccess.

Number systems are also called positional number system because


the value of each symbol (i.e., digit and alphabet) in a number
depends upon its position within the number.
Number may also have a fractional part similar to decimal numbers
used by us.
The symbol at the right most position in the integer part in a given
number has position 0. The value of position (also called position
value) in the integer part increases from right to left by 1. On the
other hand, the first symbol in the fraction part of the number has
position number –1, which decreases by 1 while reading fraction part
from left to right.
Each symbol in a number has a positional value, which is computed
using its position value and the base value of the number system.
The symbol at position number 3 in a decimal system with base 10
has positional value 103. Adding the product of positional value and
the symbol value results in the given number.
2.2.1 Decimal Number System
It is known as base-10 system since 10 digits (0 to 9) are used. A
number is presented by its two values — symbol value (any digit
from 0 to 9) and positional value (in terms of base value).
2.2.2 Binary Number System
The ICs (Integrated Circuits) in a computer are made up of a large
number of transistors which are activated by the electronic signals
(low/high) they receive. The ON/ high and OFF/low state of a
transistor is represented using the two digits 1 and 0, respectively.
These two digits 1 and 0 form the binary number system. This system
is also referred as base-2 system as it has two digits only. Some
examples of binary numbers are 1001011, 1011.101, 111111.01.

www.studifysuccess.com Made by Vrinda Rastogi


5
These notes are provided by studifysuccess.

2.2.3 Octal Number System


Octal number system was devised for compact representation of the
binary numbers. Octal number system is called base-8 system as it
has total eight digits (0-7), and positional value is expressed in
powers of 8. Three binary digits (8=23) are sufficient to represent any
octal digit.

www.studifysuccess.com Made by Vrinda Rastogi


6
These notes are provided by studifysuccess.

2.2.4 Hexadecimal Number System


Hexadecimal numbers are also used for compact representation of
binary numbers. It consists of 16 unique symbols (0–9, A–F), and is
called base16 system. In hexadecimal system, each alphanumeric
digit is represented as a group of 4 binary digits because 4 bits
(24=16) are sufficient to represent 16 alphanumeric symbols.

www.studifysuccess.com Made by Vrinda Rastogi


7
These notes are provided by studifysuccess.

2.2.5 Applications of Hexadecimal Number System

• Main memory is made up of memory locations where each location


has a unique address. Usually, size of a memory address is 16-bit or
32-bit. To access 16-bit memory address, a programmer has to use
16 binary bits, which is difficult to deal with. To simplify the address
representation, hexadecimal and octal numbers are used. Let us
consider a 16- bit memory address 1100000011110001. Using the
hexadecimal notation, this address is mapped to C0F1 which is more
easy to remember. The equivalent octal representation for this 16-
bit value is 140361.
• Hexadecimal numbers are also used for describing the colours on
the webpage. Each colour is made up of three primary colours red,
green and blue, popularly called RGB(inshort).Inmost colourmaps,
each colour is usually chosen from a palette of 16 million colours.
Therefore, 24 bits are required for representing each colour having
three components (8 bits for Red, 8 bits for Green, 8 bits for Blue
component). It is difficult to remember 24-bit binary colour code.
Therefore, colour codes are written in hexadecimal form for compact
representation. For example, 24-bit code for RED colour is
11111111,00000000,00000000. The equivalent hexadecimal
notation is (FF,00,00), which can be easily remembered and used.

www.studifysuccess.com Made by Vrinda Rastogi


8
These notes are provided by studifysuccess.

2.3 Conversion between Number Systems


2.3.1 Conversion from Decimal to other Number Systems
To convert a decimal number to any other number system (binary,
octal or hexadecimal), use the steps given below.
Step 1: Divide the given number by the base value (b) of the number
system 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)
(A) Decimal to Binary Conversion
Since the base value of binary system is 2, the decimal number is
repeatedly divided by 2 following the steps given in above till the
quotient is 0. Record the remainder after each division and finally
write the remainders in reverse order in which they are computed.

(B) Decimal to Octal Conversion-


Since the base value of octal is 8, the decimal number is repeatedly
divided by 8 to obtain its equivalent octal number.

www.studifysuccess.com Made by Vrinda Rastogi


9
These notes are provided by studifysuccess.

(C) Decimal to Hexadecimal Conversion-


Since the base value of hexadecimal is 16, the decimal number is
repeatedly divided by 16 to obtain its equivalent hexadecimal
number.

2.3.2 Conversion from other Number Systems to Decimal


Number System
We can use the following steps to convert the given number with
base value b to its decimal equivalent, where base value b can be 2,
8 and 16 for binary, octal and hexadecimal number system,
respectively.

www.studifysuccess.com Made by Vrinda Rastogi


10
These notes are provided by studifysuccess.

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 b 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
Step 4: Add all these decimal values to get the equivalent decimal
number
(A) Binary Number to Decimal Number Since binary number system
has base 2, the positional values are computed in terms of
powers of 2. Using the above mentioned steps we can convert a
binary number to its equivalent decimal value as shown below:

(B) Octal Number to Decimal Number


The following example shows how to compute the decimal
equivalent of an octal number using base value 8.

www.studifysuccess.com Made by Vrinda Rastogi


11
These notes are provided by studifysuccess.

(C) Hexadecimal Number to Decimal Number


For converting a hexadecimal number into decimal number, use
steps given in this section with base value 16 of hexadecimal
number

Note: Why 3 bits in a binary number are grouped together to get


octal number?
The base value of octal number system is 8. Convert value 8 in
terms of exponent of 2, i.e., 8=23. Hence, three binary digits are
sufficient to represent all 8 octal digits. Simply stated, count all
possible combinations of three binary digits, which are 2x2x2=8.
Therefore, 3 bits are sufficient to represent any octal digit. Hence,
3-bit groups in a binary number are formed to get equivalent octal
number.

2.3.3 Conversion from Binary Number to Octal/


Hexadecimal Number and Vice-Versa-
A binary number is converted to octal or hexadecimal number by
making groups of 3 and 4 bits, respectively, and replacing each group
by its equivalent octal/ hexadecimal digit.

www.studifysuccess.com Made by Vrinda Rastogi


12
These notes are provided by studifysuccess.

(A) Binary Number to Octal Number


Given a binary number, an equivalent octal number
represented by 3 bits is computed by grouping 3 bits from
right to left and replacing each 3-bit group by the
corresponding octal digit. In case number of bits in a binary
number is not multiple of 3, then add required number of 0s
on most significant position of the binary number.

(B) Octal Number to Binary Number


Each octal digit is an encoding for a 3-digit binary number.
Octal number is converted to binary by replacing each octal
digit by a group of three binary digits.
Note:Why 4 bits in a binary number are grouped together to get
hexadecimal number?
The base value of hexadecimal number system is 16. Write value 16
in terms of exponent of 2 i.e. 16 = 24. Hence, four binary digits are
sufficient to represent all 16 hexadecimal symbols.

www.studifysuccess.com Made by Vrinda Rastogi


13
These notes are provided by studifysuccess.

(C) Binary Number to Hexadecimal Number-


Given a binary number, its equivalent hexadecimal number is
computed by making a group of 4 binary digits from right to
left and substituting each 4-bit group by its corresponding
hexadecimal alphanumeric symbol. If required, add 0 bit on
the most significant position of the binary number to have
number of bits in a binary number as multiple of 4.

(D) Hexadecimal Number to Binary Number


Each hexadecimal symbol is an encoding for a 4-digit binary
number. Hence, the binary equivalent of a hexadecimal
number is obtained by substituting 4-bit binary equivalent of
each hexadecimal digit and combining them together.

www.studifysuccess.com Made by Vrinda Rastogi


14
These notes are provided by studifysuccess.

2.3.4 Conversion of a Number with Fractional Part


(A) Decimal Number with Fractional Part to another Number
System
To convert the fractional part of a decimal number to another
number system with base value b, repeatedly multiply the fractional
part by the base value b till the fractional part becomes 0. Use
integer part from top to bottom to get equivalent number in that
number system. If the fractional part does not become 0 in
successive multiplication, then stop after, say 10 multiplications. In
some cases, fractional part may start repeating, then stop further
calculation.
Example-Convert (0.25)10 to binary.
0.25 × 2 = 0.50 0
0.50 × 2 = 1.00 1

www.studifysuccess.com Made by Vrinda Rastogi


15
These notes are provided by studifysuccess.

Since the fractional part is 0, the multiplication is stopped. Write the


integer part from top to bottom to get binary number for the
fractional part.Therefore, (0.25)10 = (0.01)2

(B) Non-decimal Number with Fractional Part to Decimal


Number System
Compute positional value of each digit in the given number using its
base value. Add the product of positional value and the digit to get
the equivalent decimal number with fractional part.
(C)Fractional Binary Number to Octal or Hexadecimal
Number
To convert the fractional binary number into octal or
hexadecimal value, substitute groups of 3-bit or 4-bit in integer
part by the corresponding digit. Similarly, make groups of 3-bit or
4-bit for fractional part starting from left to right, and substitute
each group by its equivalent digit or symbol in Octal or
Hexadecimal number system. Add 0s at the end of the fractional
part to make a perfect group of 3 or 4 bits.

www.studifysuccess.com Made by Vrinda Rastogi

You might also like