0% found this document useful (0 votes)
8 views45 pages

HW336514

The document provides reference notes on computer fundamentals and architecture, covering topics such as computer organization, architecture, digital systems, data types, number systems, and number conversions. It explains the differences between computer organization and architecture, the types of data used in programming, and various number systems including binary, octal, decimal, and hexadecimal. Additionally, it details methods for converting decimal numbers to binary and octal equivalents.

Uploaded by

hp2209819
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)
8 views45 pages

HW336514

The document provides reference notes on computer fundamentals and architecture, covering topics such as computer organization, architecture, digital systems, data types, number systems, and number conversions. It explains the differences between computer organization and architecture, the types of data used in programming, and various number systems including binary, octal, decimal, and hexadecimal. Additionally, it details methods for converting decimal numbers to binary and octal equivalents.

Uploaded by

hp2209819
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/ 45

THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

COMPUTER ORGANIZATION

Computer Organization is realization of what is specified by the computer architecture .


It deals with how operational attributes are linked together to meet the requirements
specified by computer architecture. Some organizational attributes are hardware details,
control signals, peripherals.

Computer Organization refers to the operational units and their interconnections that
implement the architecture specification. It deals with how the components of a
computer system are arranged and how they interact to perform the required operations.
Computer organization is concerned with the physical implementation of the
architecture design and includes decisions about the interconnection and
communication between components, such as the bus structure, memory hierarchy, and
input/output systems.

COMPUTER ARCHITECTURE

Computer architecture is a blueprint for the design of a computer system and describes
the system in an abstract manner. It describes how the computer system is designed. On
the other hand, computer organization is how operational parts of a computer system
are linked together. Computer Architecture is a functional description of
requirements and design implementation for the various parts of a computer. It deals
with the functional behavior of computer systems. It comes before the computer
organization while designing a computer.

Computer architecture refers to the design of the internal workings of a computer


system, including the CPU, memory, and other hardware components. It involves
decisions about the organization of the hardware, such as the instruction set
architecture, the data path design, and the control unit design. Computer architecture is
concerned with optimizing the performance of a computer system and ensuring that it
can execute instructions quickly and efficiently.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

DIGITAL SYSTEM

A Digital computer can be considered as a digital system that performs various


computational tasks. The first electronic digital computer was developed in the late
1940s and was used primarily for numerical computations. By convention, the digital
computers use the binary number system, which has two digits: 0 and 1. A binary digit
is called a bit. A computer system is subdivided into two functional entities: Hardware
and Software. The hardware consists of all the electronic components and
electromechanical devices that comprise the physical entity of the device. The software
of the computer consists of the instructions and data that the computer manipulates to
perform various data-processing tasks.

Digital electronics is a field of computer science. It deals with devices that are used to
carry out computer applications. In digital electronics, we use two-state or binary logic.
The two logic states are “0” (low) and “1” (high). Computer uses binary number system
for its operations. Digital electronics represents the two binary numbers, 1 and 0, using
two voltage levels in a device called a logic gate. Sometimes the two states can also be
represented using Boolean logic functions, “true” or “false” states, or using an “on” or
“off” state. Logic gates are important components of a digital circuit.

A logic gate takes two inputs and generates a single output. Basically, digital data is
represented, stored, and transmitted as groups of binary digits which are called bits. The
group of bits is known as binary code. Binary codes are used in computers as they allow
computers to perform complex calculations quickly and efficiently. Binary codes are
used in financial, commercial, and industrial applications. Binary codes can be
represented as numbers and letters of the alphabets as well as many special characters
and control functions. They are classified as numeric or alphanumeric codes. Numeric
codes are used to represent numbers, whereas alphanumeric codes are used to represent
alphabetic letters and numerals.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

DATA TYPE

Computer programs or application may use different types of data based on the problem
or requirement.

Given below is different types of data that computer uses:


• Numeric data – Integer and Real numbers
• Non-numeric data – Character data, address data, logical data

Numeric data
It can be of the following two types:
• Integers
• Real Numbers

Real numbers can be represented as:


1. Fixed point representation
2. Floating point representation

Character data
A sequence of character is called character data. A character may be alphabetic (A-Z
or a-z), numeric (0-9), special character (+, #, *, @, etc.) or combination of all of these.
A character is represented by group of bits. When set of multiple character are
combined together they form a meaningful data. A character is represented in standard
ASCII format.Another popular format is EBCDIC used in large computer systems.

Example of character data


Rajneesh1#, 229/3, xyZ

Logical data
A logical data is used by computer systems to take logical decisions. Logical data is
different from numeric or alphanumeric data in the way that numeric and alphanumeric
data may be associated with numbers or characters but logical data is denoted by either
of two values true (T) or false(F). You can see the example of logical data in
construction of truth table in logic gates. A logical data can also be statement consisting
of numeric or character data with relational symbols (>, <, =, etc.).

Character set
Character sets can of following types in computers:
• Alphabetic characters- It consists of alphabet characters A-Z or a-z.
• Numeric characters- It consists of digits from 0 to 9.
• Special characters- Special symbols are +, *, /, -, ., <, >, =, @, %, #, etc.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

NUMBER SYSTEM

A computer can understand only a few symbols called digits and these symbols describe
different values depending on the position they hold in the number. In general, the
binary number system is used in computers. However, the octal, decimal and
hexadecimal systems are also used sometimes. The number system is simply a system
to represent or express numbers. There are various types of number systems and the
most commonly used ones are decimal number system, binary number system, octal
number system, and hexadecimal number system. The number system helps to
represent numbers in a small symbol set. Computers, in general, use binary numbers 0
and 1 to keep the calculations simple and to keep the amount of necessary circuitry less,
which results in the least amount of space, energy consumption and cost.

Digital and Electronic systems may use various number systems like Decimal,
Hexadecimal, Octal, and Binary. We can write a number N in base or radix b as:
Nb = dn-1 dn-2 -- -- -- -- d1 d0 . d-1 d-2 -- -- -- -- d-m
Here, dn-1 to d0 is the integer part, follows a radix point, and d-1 to d-m is the fractional
part.
dn-1 is the Most significant bit (MSB)
d-m is the Least significant bit (LSB)

Following are the number systems used in computer science:

(1) Decimal Number System


The decimal number system is a base 10 number system having ten digits from
0 to 9. It means that we can represent any numerical quantity using these ten
digits. The decimal number system is also a positional value system. It means
that the value of digits will depend on their position.

In this number system, the digits 0 to 9 represents numbers. As it uses 10 digits


to represent a number, it is also called the base 10 number system. Each digit
has a value based on its position called place value. The value of the position
increases by 10 times as we move from right to left in the number.

For example, the value of 786 is


= 7 x 102 + 8 x 101 + 6 x 100
= 700 + 80 + 6

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

(2) Binary Number System


The easiest way to run instructions through electric signals is a two-state system
– on and off. On is represented as 1 and off as 0, though 0 is no signal but a
lower voltage signal. The number system having only these two digits (0 & 1)
is called a binary number system. The rightmost digit is the LSB(least
significant bit) in any binary number, and the leftmost digit is the MSB(most
significant bit).

A computer can understand only the “on” and “off” state of a switch. These two
states are represented by 1 and 0. The combination of 1 and 0 form binary
numbers. These numbers represent various data. As two digits are used to
represent numbers, it is called a binary or base 2 number system. The binary
number system uses positional notation. But in this case, each digit is multiplied
by the appropriate power of two based on its position.

For example, (101101)2 in decimal is


= 1 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
= 1 x 32 + 0 x 16 + 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1
= 32 + 8 + 4 + 1
= (45)10

(3) Octal Number System


The octal number system has eight digits - 0, 1, 2, 3, 4, 5, 6, and 7. The octal
number system is a positional value system where each digit is expressed in
powers of 8.

This system uses digits 0 to 7 (i.e. 8 digits) to represent a number and the
numbers are as a base of 8.

For example, (24)8 in decimal is


= 2×81+4×80
= (20)10

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

(4) Hexadecimal Number System


The octal number system has 16 symbols from 0 to 9 and A to F where A is
equal to 10 and B is equal to 11, until F. The Hexadecimal number system is
also a positional value system where each digit has its value expressed in powers
of 16

In this system, 16 digits used to represent a given number. Thus it is also known
as the base 16 number system. Each digit position represents a power of 16. As
the base is greater than 10, the number system is supplemented by letters.
Following are the hexadecimal symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 as A, 11
as B, 12 as C, 13 as D, 14 as E and 15 as F
To take A, B, C, D, E, and F as part of the number system is conventional and
has no logical or deductive reason.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

NUMBER CONVERSIONS
Conversion of decimal number to any number system require following steps:

Step 1: convert the integer part by doing successive division using the radix of asked
number systems.

Step 2: convert the fractional part by doing successive multiplication using radix of
asked number system

Decimal-to-Binary Conversion

The conversion of whole numbers from decimal to binary number is known as


Repeated Division by 2 Method or Divide by 2 Method. In this method the decimal
number is repeatedly divided by 2 and noting down the remainder. Finally, to get the
binary equivalent of the given decimal number, noting down the remainders from
bottom to top. Means first remainder to be got is the LSB in the binary number and the
remainder got at the last is the MSB in the binary number.

Example : Convert (27)10 to equivalent Binary Number.

Radix/Base Number ÷ Base Remainder


2 27 1
2 13 1
2 6 0
2 3 1
2 1

Thus, (27)10 = (11011)2

The method of converting decimal fractions to binary equivalent is known as Repeated


Multiplication by 2 Method. In this method the decimal fractions can be converted by
repeated multiplications by 2 until the fractional part is zero. The process of finding binary
equivalent for the integer part remains the same as above. The integer generated by the product
is the binary number is obtained by noting down the integer produce by the multiplication from
top to bottom for the decimal part.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Example : Convert (25.15625)10 to equivalent Binary Number.

Integer Part
Radix/Base Number ÷ Base Remainder
2 25 1
2 12 0
2 6 0
2 3 1
2 1

so, (25)10 = (11001)2

Decimal Part
Decimal Part x Base Result Value
0.15625 x 2 0.31250 0
0.31250 x 2 0.62500 0
0.62500 x 2 1.25000 1
0.25000 x 2 0.50000 0
0.50000 x 2 1.00000 1

so, (0.15625)10 = (0.00101)2

Hence, (25.156625)10 = (11001.00101)2

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Decimal-to-Octal Conversion

The method of converting decimal numbers to an equivalent octal number is similar to


the method used in decimal to binary conversion since octal numbers has base of 8
therefore, we use Repeated Division by 8 Method to convert the integer part of
decimal numbers to octal equivalent and use Repeated Multiplication by 8 Method
to convert the fractional decimal to equivalent octal number.

Example : Convert (127)10 to equivalent Octal Number.

Radix/Base Number ÷ Base Remainder


8 127 7
8 15 7
1

so, (127)10 = (177)8

Example : Convert (89.1625)10 to equivalent Octal Number.

Integer Part
Radix/Base Number ÷ Base Remainder
8 89 1
8 11 3
1

so, (89)10 = (131)8

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Decimal Part
Decimal Part x Base Result Value
0.1625 x 8 1.3000 1
0.3000 x 8 2.4000 2
0.4000 x 8 3.2000 3
0.2000 x 8 1.6000 1
0.6000 x 8 4.8000 4
0.8000 x 8 6.4000 6
Since fractional part is repeating so stop

so, (0.1625)10 = (0.123146)8

Hence, (89.1625)10 = (131.123146)8

Decimal-to-Hexadecimal Conversion

The method of converting decimal numbers to an equivalent octal number is similar to


the method used in decimal to binary conversion since octal numbers has base of 8
therefore, we use Repeated Division by 16 Method to convert the integer part of
decimal numbers to octal equivalent and use Repeated Multiplication by 16 Method
to convert the fractional decimal to equivalent octal number.

Example : Convert (829)10 to equivalent Hexadecimal Number.

Radix/Base Number ÷ Base Remainder


16 829 13  D
16 51 3
3

so, (829)10 = (33D)16

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Example : Convert (778.7625)10 to equivalent Hexadecimal Number.

Integer Part
Radix/Base Number ÷ Base Remainder
16 778 10  A
16 48 0
3

so, (778)10 = (30A)16

Decimal Part
Decimal Part x Base Result Value
0.7625 x 16 12.2000 12  C
0.2000 x 16 3.2000 3
0.2000 x 16 3.2000 3
Since fractional part is repeating so stop

so, (0.7625)10 = (0.C33)16

Hence, (778.7625)10 = (30A.C33)16

Binary-to-Decimal Conversion

Any binary number can be converted into decimal number using the weights assigned
to each bit as per its base.

Example : Convert (11011)2 to an equivalent Decimal number.

(MSB) (LSB)
Bits 1 1 0 1 1
Weights 24 23 22 21 20 Bit x Weight
1 x 20 = 1
1 x 21 = 2
0 x 22 = 0

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

1 x 23 = 8
1 x 24 = 16
Sum = 27
Hence, (11011)2 = (27)10

Example : Convert (10101.1101)2 to an equivalent Decimal number.

Integer Part

Bits 1 0 1 0 1
Weights 24 23 22 21 20 Bit x Weight
1 x 20 = 1
0 x 21 = 0
1 x 22 = 4
0 x 23 = 0
1 x 24 = 16
Sum = 21
Integer Part (10101)2 = (21)10

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Decimal Part :

Bits 1 1 0 1
Weights 2-1 2-2 2-3 2-4
Bit x Weight Value
1 x 2-4 = 1 x 1/24 =0.0625
0 x 2-3 = 0 x 1/23 =0
1 x 2-2 = 1 x 1/22 =0.25
1 x 2-1 = 1 x 1/21=0.50
Sum = 0.8125
So, (1101)2 = (0.8125)10

Hence, (10101.1101)2 = (21.8125)10

Octal-to-Decimal Conversion

Octal to decimal conversion is similar to the method used in binary to decimal


conversion just we have to change the weights assigned to each octal number.

Example : Convert (735)8 to an equivalent Decimal number.

Bits 7 3 5
Weights 82 81 80
Bit x Weight
5 x 80 = 5
3 x 81 = 24
7 x 82 = 448
Sum = 477
Hence, (735)8 = (477)10

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Example : Convert (146.51)8 to an equivalent Decimal number.

Integer Part

Bits 1 4 6
Weights 82 81 80
Bit x Weight
6 x 80 = 6
4 x 81 = 32
1 x 82 = 64
Sum = 102
Integer Part (146)8 = (102)10

Decimal Part :

Bits 5 1
Weights 8-1 8-2
Bit x Weight Value
1 x 8-2 = 1 x 1/82= 1/64
5 x 8-1 = 0 x 1/8 = 5/8
Sum = 0.640625
So, (51)2 = (0.640625)10

Hence, (146.51)8 = (102.640625)10

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Hexadecimal-to-Decimal Conversion

Hexadecimal to Decimal conversion is similar to the method used in binary to decimal


conversion just we have to change the weights assigned to each hexadecimal number.

Example : Convert (2A5B)16 into equivalent Decimal number.

Bits 2 A 5 B
Weights 163 162 161 160
Bit x Weight
11 x 160 = 11
5 x 161 = 80
10 x 162 = 2560
2 x 163 = 8192
Sum = 10843
Hence, (2A5B)16 = (10843)10

Example : Convert (2D.5B)16 into equivalent Decimal number.

Integer Part:

Bits 2 D
Weights 161 160
Bit x Weight
13 x 160 = 13
2 x 161 = 32
Sum = 45
so, (2D)16 = (45)10

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Decimal Part:

Bits 5 B
Weights 16-1 16-2
Bit x Weight
11 x 16-2 = 11/256 = 0.04296875
5 x 161 = 5/16 = 0.3125
Sum = 0.35546875
So, (0.5B)16 = (0.35546875)10

Hence, (2D.5B)16 = (45.35546875)10

Octal-to-Binary Conversion

It is carried out using an octal number table which is having a three-bit equivalent binary
number for each octal digit. Here the given octal number is converted into equivalent
3-bit binary number using this table.

Octal Number 3-Bit Binary Number


0 000
1 001
2 010
3 011
4 100
5 101
6 101
7 111

Example : Convert Octal Number (407)8 into equivalent Binary Number.

Octal Number 4 0 7
3-Bit Binary Number 100 000 111

Hence, (407)8 = (100000111)2

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Example : Convert Octal Number (700.0356)8 into equivalent Binary Number.

Octal Number 7 0 0 . 0 3 5 6
3-Bit Binary Number 111 000 000 . 000 011 101 110

Hence, (700.0356)8 = (111000000.000011101110)2

Binary-to-Octal Conversion

It is also carried out using an octal number table having a three-bit equivalent binary
number for each octal digit. For every given binary number, we make a group of three
bits from right to left for integer part and from left to right for the fractional part starting
from the decimal point. If the left most group in the integer part and the right most
group in the fractional part represent with less than 3-bits then we make that group
complete by adding one or two zeros.

Octal Number 3-Bit Binary Number


0 000
1 001
2 010
3 011
4 100
5 101
6 101
7 111

Example : Convert Binary Number (11010111)2 into equivalent Octal Number.

Binary Number Pairs ( R → L ) 11 010 111


Complete 3-Bit Binary Number 011 010 111
Octal Number 3 2 7

Hence, (11010111)2 = (327)8

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Example : Convert Binary Number (10000100.100110011)2 into equivalent Octal


Number.
(L←R) (L→R)
Number Pairs - -1 000 100 . 100 110 011
3-Bit Binary 001 000 100 . 100 110 011
Octal Number 1 0 4 . 4 6 3

Hence, (1000100.100110011)2 = (104.463)8

Hexadecimal-to-Binary Conversion

It is carried out using a hexadecimal number table which is having a four-bit equivalent
binary number for each hexadecimal digits. Here the given hexadecimal number is
converted into equivalent 4-bit binary number using this table.

Hexadecimal Number 4-Bit Binary Number


0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0101
7 0111
8 1000
9 1001
10  A 1010
11  B 1011
12  C 1100
13  D 1101
14  E 1110
15  F 1111

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Example : Convert Hexadecimal Number (29A6)16 into equivalent Binary Number.

Hexadecimal Number 2 9 A 6
4-Bit Binary Number 0010 1001 1010 0110

Hence, (29A6)16 = (0010100110100110)2

Example : Convert Hexadecimal Number (DC5A.3E4)16 into equivalent Binary


Number.

Hexadecimal Number D C 5 A . 3 E 4
4-Bit Binary Number 1101 1100 0101 1010 . 0011 1110 0100

Hence, (DC5A.3E4)16 = (1101110001011010.001100010110)2

Binary-to-Hexadecimal Conversion

It is also carried out using a hexadecimal number table having a 4-bit equivalent binary
number for each hexadecimal digit. For every given binary number, we make a group
of 4-bits from right to left for integer part and from left to right for the fractional part
starting from the decimal point. If the left most group in the integer part and the right
most group in the fractional part represent with less than 4-bits then we make that group
complete by adding one, two or three zeros.

Example : Convert Binary Number (11011101100)2 into equivalent Hexadecimal.

Binary Number Pairs (L ← R) 110 1110 1100


Complete 4-Bit Binary Number 0110 1110 1100
Hexadecimal Number 6 E C

Hence, (11011101100)2 = (6EC)16

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Example : Convert Binary Number (1010100.101101)2 into equivalent


Hexadecimal Number.
(L←R) (L→R)
Number Pairs 101 0100 . 1011 01
4-Bit Binary 0101 0100 . 1011 0100
Hexadecimal Number 5 4 . B 4

Hence, (1010100.101101)2 = (54.B4)16

Hexadecimal-to-Octal

For converting Hexadecimal Number to Octal Number, we first have to convert


Hexadecimal Number into Binary Number with 4-bit code and then convert this Binary
Number into Octal Number with 3-bit binary number.

Example : Convert Hexadecimal Number (27A9)16 into equivalent Octal Number.

Hexadecimal Number 2 7 A 9
4-Bit Binary Number 0010 0111 1010 1001

so, (27A9)16 = (0010011110101001)2

Now converting Binary to Octal

Binary Number Pairs ( R → L ) 00 010 011 110 101 001


Complete 3-Bit Binary Number 000 010 011 110 101 001
Octal Number 0 2 3 6 5 1

so, (0010011110101001)2 = (23651)8

Hence, (27A9)16 = (23651)8

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Example : Convert Hexadecimal Number (85C.BD3)16 into equivalent Octal Number.

Hexadecimal Number 8 5 C . B D 3
4-Bit Binary Number 1000 0101 1100 . 1011 1100 0011

so, (85C.BD3)16 = (100001011100.101111000011)2

Now converting Binary to Octal

(L←R) (L→R)
3-Bit Binary Number 100 001 011 100 . 101 111 010 011
Octal Number 4 1 3 4 . 5 7 2 3

So, (100001011100.101111000011)2 = (4134.5723)8

Hence, (85C.BD3)16 = (4134.5723)8

Octal-to-Hexadecimal Conversion

For converting Octal Number to Hexadecimal Number, we first have to convert given
Octal Number into Binary Number using 3-bit code and then convert this Binary
Number into Hexadecimal Number using 4-bit code.

Example : Convert Octal Number (3562)8 into equivalent Hexadecimal Number.

Octal Number 3 5 6 2
3-Bit Binary Number 011 101 110 010

so, (3562)8 = (011101110010)2

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Now converting Binary to Hexadecimal

4- bit Binary Number Pairs ( L ← R ) 0111 0111 0010


Hexadecimal Number 7 7 2

so, (011101110010)2 = (772)16

Hence, (3562)8 = (772)16

Example : Convert Octal Number (4567.266)8 into equivalent Hexadecimal Number.

Octal Number 4 5 6 7 . 2 6 6
3-Bit Binary Number 100 101 110 111 . 010 110 110

so, (4567.266)8 = (100101110111.010110110)2


Now converting Binary to Octal
(L←R) (L→R)
4-Bit Binary Number 1001 0111 0111 . 0101 1011 0000
Octal Number 9 7 7 . 5 B 0

So, (100101110111.010110110)2 = (977.5B0)16

Hence, (4567.266)8 = (977.5B0)16

REPRESENTATION OF SIGNED BINARY NUMBERS

Signed binary numbers can be represented in the following three forms:

(1) Sign-Magnitude
(2) 1’s Complement
(3) 2’s Complement

Sign-Magnitude Form

The binary number in sign-magnitude form is represented by one sign bit and
magnitude bits. The MSB (Left Most Bit) in the signed number is the sign bit which is set to

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

‘0’ indicating a positive number and ‘1’ indicating a negative number. The magnitude bits gives
the value of the signed number.

Example :
(110110)2 represents (-22)10. The MSB is ‘1’ which indicates that the number is
negative and the remaining 5-bits gives its magnitude.

1 1 0 1 1 0

Sign-Bit
Magnitude Bits

Similarly, (010110)2 represents (+22)10. The MSB is ‘0’ which indicates that the
number is positive and the remaining 5-bits gives its magnitude.

0 1 0 1 1 0

Sign-Bit
Magnitude Bits

One’s Complement Form

 One’s / 1’s Complement of any binary number can be obtained by changing all 1’s with
0’s and all 0’s with 1’s. This form is used for representing the signed numbers.

Example : 1’s complement of (101101)2 = (010010)2

 Similar to the sign-magnitude representation, the MSB or LMB (sign-bit) in 1’s


complement is used for representing sign ( 0 for positive and 1 for negative)

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

 In 1’s complement form, if the number is Positive, then the 1’s complement of that
number is negative with the same value (magnitude)

Example : (0011)2 = ( +3 )10 1’s Complement = (1011)2 = ( -3 )10

 If ‘ n ‘ is the number of bits then,

• Maximum Positive Number in 1’s Complement form = ( 2n-1 – 1)

• Maximum Negative Number in 1’s Complement form = ( -2n-1 – 1)

Example:
With 4-bits
Maximum Positive number is (24-1 – 1) = (8 – 1) = (+7)10
Maximum Negative number is - (24-1 – 1) = - (8 – 1) = (-7)10

With 5-bits
Maximum Positive number is (25-1 – 1) = (16 – 1) = (+15)10
Maximum Negative number is - (25-1 – 1) = - (16 – 1) = (-15)10

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Two’s Complement Form

 Two’s / 2’s Complement of any binary number can be obtained by adding 1 to 1’s
complement of the binary number. Signed numbers are represented similar to 1’s
complement form in 2’s complement form. It is most widely used in Computer (ALU) to
represent negative numbers.

Example : 2’s complement of (101101)2


1’s complement + 1 = ( 010010 + 1)2 = (010011)2

 If a binary number is positive, then 2’s complement of that number is negative with the
same value.

Example : (0011)2 = ( +3 )10 2’s Complement = (1011)2 = ( -3 )10

 If ‘ n ‘ is the number of bits then,

• Maximum Positive Number in 2’s Complement form = ( 2n-1 – 1)

• Maximum Negative Number in 1’s Complement form = ( -2n-1 )

Example:
With 4-bits
Maximum Positive number is (24-1 – 1) = (8 – 1) = (+7)10
Maximum Negative number is - ( 24-1 ) = - (8) = (-8)10

With 5-bits
Maximum Positive number is (25-1 – 1) = (16 – 1) = (+15)10
Maximum Negative number is - (25-1) = - (16) = (-16)10

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

BINARY AIRTHMETIC OPERATIONS IN NUMBER SYSTEMS

Binary operation is an operation that requires two inputs. These inputs are known as operands.
The binary operation of addition, multiplication, subtraction and division takes place on two
operands. Even when we add any three binary numbers, we first add two numbers and then the
third number will be added to the result of the two numbers. Thus, the mathematical operations
which are done with the two numbers are known as binary operations.

Binary Operation Types


Binary operations such as binary addition, binary subtraction, binary multiplication
and binary division are calculated similarly as the arithmetic operations are calculated in
numerals.These are four types of binary operations namely
• Binary Addition
• Binary Subtraction
• Binary Multiplication
• Binary Division

Binary Addition
The result obtained after adding two binary numbers is the binary number itself. Binary
addition is the simplest method to add any of the binary numbers.

Rules
• 0+0=0
• 0+1=1
• 1+0=1
• 1 + 1 =10 (Sum = 0, Carry = 1)

Example: 10001 + 11101 = 101110


Carry
1 1
1 0 0 0 1
+ 1 1 1 0 1
1 0 1 1 1 0

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Binary Subtraction
The result obtained after subtracting two binary numbers is the binary number itself.
Binary subtraction is also the simplest method to subtract any of the binary numbers.

Rules
• 0–0=0
• 0 – 1 = 1 (with a borrow of 1)
• 1–0=1
• 1–1=0

Example: 1001 - 0110 = 0011


borrow

1 0 10 1
- 0 1 1 0
0 0 1 1

Binary Multiplication
The binary multiplications are calculated similarly as the other arithmetic numerals are
calculated.
Rules
• 0×0=0
• 0×1=0
• 1×0=0
• 1×1=1

Example: 1101 * 1010 = 10000010

1 1 0 1
x 1 0 1 0
0 0 0 0
1 1 0 1
0 0 0 0
+ 1 1 0 1
1 0 0 0 0 0 1 0

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Binary Division
The method of binary division is similar to the 10 decimal system other than the base 2
system.
Rules:
• 1÷1=1
• 0÷1=0
• 1 ÷ 0 = Not Defined
• 0 ÷ 0 = Not Defined

Example: 1111100 ÷ 010 = 111110

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

COMPUTER CODES / BINARY CODES / DIGITAL CODES

In the digital logic circuits, each decimal or piece of information is represented through
an equivalent combination of binary digits. A complete group of such combinations,
which represents numbers, layers, or symbols, is known as a digital or binary code.
Further, the method of converting a decimal number to a binary number is called
coding. These are codes, which apparently look like to be a combination of binary
numbers, however, they are not featured according to the ideology of binary numbers.
These codes are normally used in order to switch binary numbers from one system to
the other.

Codes are used for security purposes so that in case the message has been detected, it
may not be deciphered or decoded. In modern digital instruments, codes are used in
order to describe, represent and process arithmetic information (i.e. addition,
subtraction, multiplication, and division). The selection of a code depends on the nature
or purpose of the work going to be availed through it. Some codes are suitable for
conducting arithmetic processes while others are famous for their high accuracy and
efficiency (i.e. such codes deliver significant information through the application of a
few bits)

Under specific applications, the circuit required for processing of information becomes
simple and concise as a result of the application of one code or the other. Further, the
reliability of a digital system enhances as a result of a finite switching circuit.

Types of Binary Codes or Digital Codes

Further codes being used in the digital systems are of the following two types
1. Numeric weighted code
2. Special binary codes or non-weighted code

Numeric or Weighted Codes


These are the codes, wherein every digit has got some particular weight. For example,
BCD (binary coded decimal) is a weighted code. The explanation of BCD is as follows:

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

BCD or 842 Code

These are the codes wherein every decimal digit is denoted by a group of four bits. As
the weight of a 4-bit position from right to left is 8-4-2-1, that’s why it is also known
as an 8421 code. As every digit present in it has a specific weight, that’s the reason it
is generally considered as a weighted or numerical code.

Binary Code Decimal (BCD) is a method for the description of every decimal digit
with respect to its binary code. As there are just 10 code groups (0-9) in the BCD
system, therefore it is quite easy to convert decimal to BCD or BCD to decimal. As a
result of being familiar with the decimal number system, we prefer to read or write in
decimals. Whereas, looking at any binary number, it seems a bit difficult to calculate
an equivalent decimal number forthwith.

For example, binary (00110101)2 denotes (35)10 in decimal, nonetheless, it is obviously


difficult to tell its decimal number immediately after looking at this binary. However,
its equivalent decimal number may be calculated from this binary after a few minutes.

Thus, this process entails a substantial waste of time, which is a significant drawback
of the binary to decimal conversion method (which has been discussed in the previous
pages). In order get rid of the specific flaw, engineers have designed a special code
which keenly resembles a decimal number system. This specific code is called BCD.
As decimal numbers are used on input and output of most of the digital components
and circuits, therefore this particular code is fairly popular owing to having a
characteristic combination of both binary as well as digital systems.

In other words, Binary Coded Decimal (or the decimal coded into binary) means
expression of every decimal digit (0-9) by means of a 4 – bits binary code, while code
8421 represents the binary weights of these four bits (i.e. 23, 22, 21, 20). The greatest
advantage of this code is that it is pretty easy to interconvert 8421 code numbers with
ordinary decimal numbers. Remember that a total of 16 binary numbers (from 0000 to
1111) can be represented with 4 – bits. However, only first ten numbers out of these are
used in 8421 code, whereas the remaining six (i.e. 1010, 1011, 1100, 1101, 1110 and
1111) have been invalidated in the BCD code 8421.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Decimal to BCD Conversion

Decimal BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

BCD codes are not simply analogous to the binary codes or Digital Codes.

For example, 10 is represented as 1010 in the binary system, however it is denoted as


0000 0001 in BCD.

Similarly, 17 is shown as 10001 in the binary system, whereas in BCD code, it is


denoted as 0001 0111.

For the purpose of converting any decimal number to BCD, a 4-digit binary code is
mentioned with its corresponding decimal digit. An appropriate space is also kept
within every 4 – bits group, so that a distinction could be maintained between an
ordinary binary code and a BCD code.

The greatest advantage of a BCD code is that it is fairly easy to read, write, identify and
even to memorize the arrangement of first 10 numbers. As BCD numbers look like
decimal numbers, therefore when we have to work continuously with BCD numbers,
we can quite easily convert a BCD number to an equivalent decimal number and a
decimal number into BCD instantly after having a look at these. However, in spite of
its merits, BCD code has certain deficiencies or drawbacks as well. For example,
performance of a BCD is inferior as compared to a pure binary code. Moreover,
relatively large bits are required for the conversion of any decimal number into a BCD
code. As a result, performance suffers, apart from the need for the provision of an extra
circuit (e.g. 25 in the pure binary code is written as 11001 (look at the table 1.2).
However, in situation of BCD, 25 is written as 0010 0101). Resultantly, cost goes up,
circuit becomes more complex and more power consuming. Moreover, by invalidating

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

or not using the six numbers (10 – 15) is in itself a major drawback. As a consequence,
effectiveness deteriorates further.

Conversion of Decimal to BCD Code & BCD Code to Decimal


Any decimal number can be converted to a BCD code quite effortlessly. For
this purpose, a 4-bit binary code is written with each and every decimal digit of
a decimal number. And a reasonable space is left within every 4 – bit groups.
On the contrary, a BCD number can also quite conveniently be converted to a
decimal number. For this end, the code number is divided into a 4 – bit groups
(starting with the LSB side). Thereafter, a decimal digit is mentioned with every
4 – bit group.

Example : Convert the decimal number (369)10 in BCD

With the help of above table, replace the value of each decimal digit by its 4 – bit
equivalent from the BCD code.
3 = 0011, 6 = 0110, and 9 = 1001
Thus, (369)10 = 0011 0110 1001 in BCD

Example : Convert the BCD code number 0001010001110101 into equivalent


decimal value.

Starting from the LSB, the given number can be divided into groups of four bits as.
0001 0100 0111 0101

With the help of table, we get.


0001 0100 0111 0101
↓ ↓ ↓ ↓
1 4 7 5

Hence, 0001010001110101BCD = 147510

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Special Binary Codes or Non-Weighted Codes


These codes are normally of the following types.
1. Gray Codes
2. Excess-3 Code
3. ASCII (American Standard Code for Information Interchange)

Gray Code
Gray code is a non – weighted or un – weighted and non – arithmetic code, which is
profusely employed in mechanical switching systems. It means that no specific weight
or position value is fixed for the bit positions of this code, nor can they be utilized for
any kind of arithmetic operations (i.e. gray code is not used when numbers are required
to be added, subtracted or during any other arithmetic operation). This code is also
known as a cyclic or reflective code.

Just like a pure binary code, the first ten digits (0 – 9) are also used in BCD. An
important advantage of gray code is that a change of only one bit takes place from one
code number to other (which has been explained via the table). The very advantage of
this code makes it pretty suitable for a number of applications.

For example, in a shaft position encoder, where the possibility of errors mounts owing
to a change between the quantity of bits of arranged numbers located adjacently. In
such situations, gray codes are enormously used, which eliminate inherent faults
existing in the binary code, because, a change of just one – bit occurs between such
end-to-end numbers. As a consequence, the quantity of switching declines and trust on
the switching system grows further. Moreover, function of the circuit also improves
effectively due to a minimum possibility of committing any sort of errors under the
gray code technique.
In table 1.7, a 4 – bit gray code has been displayed, which consists of a list of 4 – bit
gray codes for the decimal numbers ranged from 0 – 15. In order to comprehend
mechanism that a variation of just one bit occurs between one number of a gray code
to the other (or end -to – end numbers), it is necessary to go through the given table
carefully. For example, note down the change taking place between decimal number 3
and decimal number 4. As a result of an inter -change taking place between these two
decimal numbers, a change of just one bit occurs in the gray code from 0010 to 0110.
Whereas, in case of binary codes or Digital Codes, a change of 3 bits occurs from 0011
to 0100 (that’s 1st both bits change from 11 to 00 and the third bit changes from 0 to 1)

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Four–Bit Gray Code

Decimal Binary Gray Code Decimal Binary Gray Code


0 0000 0000 8 1000 1100
1 0001 0001 9 1001 1101
2 0010 0011 10 1010 1111
3 0011 0010 11 1011 1110
4 0100 0110 12 1100 1010
5 0101 0111 13 1101 1011
6 0110 0101 14 1110 1001
7 0111 0100 15 1111 1000

The Excess -3 Code


The Excess-3 code (which is shortly denoted as XS-3), is actually a modified
form of BCD. It is an unweighted code, which is immensely used in digital
instruments in order to express numerical or arithmetic data and information.

Every code number mentioned in XS-3 code is three-fold compared to the


number mentioned in BCD code. For example, decimal number 6, which is
equal to 0110 in case of BCD, whereas it is mentioned as 1001 in case of XS-3
(as has been illustrated in the table), which in fact is 9. It implies that XS-3 is
three times larger as compared to a BCD. It needs to be remembered here that
XS-3 is more feasible for the purpose of carrying out arithmetic operations as
compared to BCD.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Excess-3 Code
Decimal BCD Excess-3
0 0000 0001
1 0001 0100
2 0010 0101
3 0011 0110
4 0100 0111
5 0101 1000
6 0110 1001
7 0111 1010
8 1000 1011
9 1001 1100

Thus, Excess–3 is an important 4–bit code, which can occasionally be used in


conjunction with BCD and which is utilized by means of adding 3 to every decimal
digit (i.e. in order to convert a decimal number to an equivalent 3 – excess code, 3 is
added with every decimal digit) and then the sum is changed to a BCD number. For
example, excess – 3 codes of decimal 2 and decimal 9 are as under:
2 9
+3 +3
ꟷ ꟷ
5 → 0101 12 → 1100

Example: Convert 12 to an excess – 3 code.

First add 3 to each decimal digit.


1 2
+3 +3
----- -----
4 5

Second, convert the sum to BCD form.


4 5
↓ ↓
0100 0101

So, 0100 0101 is the excess -3 code which stands for decimal 12.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Alpha- Numeric Code

The special type of codes that are generally used to depict numbers, letters,
symbols, and instructions, are known as alpha–numeric codes (that’s the binary
codes or Digital Codes which are used in order to express the characteristics of
both alphabetic as well as alphanumeric type. Because for the transmission or
communication of information from one place to another, we not only need
numbers, we also require the application of certain letters)

Alphanumeric code is a binary code, which comprises 10 decimal digits, 26


alphabet letters and a number of other symbols (e.g. $, % and? etc.). The most
important type of alphanumeric code is ASCII, which is known as an American
standard code for information. The detail of this code is as under:

American Standard Code for Information Interchange(ASCII)

ASCII is a world recognized alpha – numeric code which is mostly used in


computers and other digital electronic devices. Most of the computers’
keyboards have been standardized with ASCII. When you enter a letter or word,
a number or a control command, the pertinent ASCII code passes on to the
computer.

ASCII consists a total of 128 characters and symbols, which is represented via
a binary code (i.e. it is a 7 – bit binary code because a total of 27= 128 different
conditions or numbers can be represented via a 7- bit). The first 32 ASCII
characters include non- graphic commands, which can neither be printed nor
displayed. Rather, these are only used for the purpose of exercising control.
Null, line feed, start of text and escape etc. are some of the instances of control
character. Other characters are graphic symbols, which can both be printed or
displayed. It contains letters of alphabet (i.e. capital and small English
characters), 10 decimal digits (i.e. numbers from 0 to 9) and punctuation signs
and other commonly used symbols and codes.

ASCII code comprises 128 characters and symbols. It represents every character
and symbol in a decimal, hexadecimal and binary. The names of 32 control
characters (00 to IF hexadecimal), have been presented in the left section. These
control characters are used for communication purposes while transmitting data
or information through devices e.g. computers and printers. Whereas graphic
symbols (from 20 to 7F hexadecimal) have been demonstrated in the remaining
section of the table.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

ASCII Control Characters


Name Decimal Hex Key Description
Null 0 00 CTRL a Null character
SOH 1 01 CTRL.A Start of header
STX 2 02 CTRL.B Start of text
ETX 3 03 CTRL.C End of text
EOT 5 05 CTRL. D End of transmission
ENQ 5 05 CTRL.E Enquire
ACK 6 06 CTRL. F Acknowledge
BEL 7 07 CTRL.G Bell
BS 8 08 CTRL.H Back Space
HT 9 09 CTRL.I Horizontal tab
LF 10 0A CTRL.J Line feed
VT 11 0B CTRL.K Vertical tab
FF 12 0C CTRL.L Form feed
CR 13 0D CTRL.M Carriage return
SO 14 0E CTRL.N Shift out
SI 15 0F CTRL.O Shift in
DLF 16 10 CTRL.P Date line escape
DC1 17 11 CTRL.Q Device control1
DC2 18 12 CTRL.R Device control 2
DC3 19 13 CTRL.S Device control 3
DC4 20 14 CTRL.T Device control 4
NAK 21 15 CTRL.U Negative acknowledge
SYN 22 16 CTRL.V Synchronize
ETB 23 17 CTRL.W End of transmission block
CAN 24 18 CTRL.X Cancel
EM 25 19 CTRL.Y End of medium
SUB 26 1A CTRL.Z Substitute
ESC 27 1B CTRL. │ Escape
FS 28 1C CTRL. / File separator
GS 29 1D CTRL. │ Group separator
RS 30 1E CTRL. ^ Record separator
US 31 1F CTRL. Unit separator

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

In order to provide and receive information via a computer, we often need to apply
certain alpha numeric codes. There was a time when manufactures used their own alpha
– numeric codes, which caused all sorts of mix-up and confusion. Eventually, the
industry agreed on an input – output code, which is known as American Standard Code
for Information Interchange (ASCII). It must be remembered that ASCII is pronounced
as ask – ee). After the introduction of this code, different computer hardware’s e.g.
keyboard, printers, video displays etc. got standardized. ASCII is a 7 – bit code, the
format of which is as follows:

3-Bit Group 4- Bit Group


X6 X5 X4 X3 X2 X1 X0

It should be remembered that the ASCII 7 – bit code for every letter, number or control
function is composed through a group of 3 – bit and another group of 4 – bit and that
the value of each X in every group is zero or 1. In the table 1.11, ASCII code has been
displayed. Through the application of this table, alphabet letters or some commonly
used symbols can be determined from top or bottom. For example, the table reveals that
the X4, X5, X6 value of capital letter A is 100 (this is binary value of 3 – bit) and value
of X0, X1, X2, X3 (i.e. binary value of next 4 – bit) is 0001. As such, the ASCII code
value for A is as under:

X6 X5 X4 X3 X2 X1 X0
1 0 0 0 0 0 1

For reading purposes, some space is left blank in-between. i.e.


100 0001 (A)

Some other examples are as follows:


110 0001 (a)
110 0010 (b)
110 0011 ©
010 0100 ($)
010 1011 (+)
011 1101 (=)
010 0000 (SP or Space)

ASCII code is quite extensively used in computers and data communication devices
(e.g. printers, telephone lines etc.) for data communication.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

ASCII Code
X6X5X4
X3X2X1X0 010 011 100 101 110 111
0000 SP 0 @ P p
0001 ! 1 A Q a q
0010 “ 2 B R b r
0011 # 3 C S c s
0100 $ 4 D T d t
0101 % 5 E U e u
0110 & 6 F V f v
0111 ‘ 7 G W g w
1000 ( 8 H X h x
1001 ) 9 I Y i y
1010 * : J Z j z
1011 + ; K k
1100 ‘ < L l
1101 – = M m
1110 . > N n
1111 / ? O o

EXTENDED BINARY CODED DECIML INTERCHANGE CODE (EBCDIC)

It is pronounced as “Eb-Si-Dic”. It is an 8-bit code which permits 256 Unique Codes,


which are more than enough to represent 26 Alphabet Characters, 10 Decimal Digits,
and commonly used special symbols. This code handles all types of data and can be
invariably used in business data processing by all types of computers from micro, mini
to mainframe systems.

The data represented in ASCII format can be easily converted into EBCDIC format and
vice-versa, in-order to suit the requirements of a particular computer systems. Each
EBCDIC character is represented by a unique string of 1’s and 0’s, with each string of
8-bits. The 4 Left-handed bits are referred to as “Zone Bits”, which identify the group
classification of a character. The 4 Right-handed bits are referred to as “Numeric Bits”
representing code.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Characters Zone Bits Numeric Bits


0 to 9 1111 0000 to 1001
A to I 1100 0001 to 1001
J to R 1101 0001 to 1001
S to Z 1110 0001 to 1001

ERROR DETECTION AND CORRECTION CODES

We know that the bits 0 and 1 corresponding to two different range of analog voltages.
So, during transmission of binary data from one system to the other, the noise may also
be added. Due to this, there may be errors in the received data at other system. That
means a bit 0 may change to 1 or a bit 1 may change to 0. We can’t avoid the
interference of noise. But, we can get back the original data first by detecting whether
any errors present and then correcting those errors. For this purpose, we can use the
following codes.
• Error detection codes
• Error correction codes

Error Detection Codes


They are used to detect the errors present in the received data bitstream. These codes
contain some bits, which are included appended to the original bit stream. These codes
detect the error, if it is occurred during transmission of the original data bitstream.

Example − Parity code, Hamming code.

Error Correction Codes

They are used to correct the errors present in the received data bitstream so that, we will
get the original data. Error correction codes also use the similar strategy of error
detection codes.
Example − Hamming code.

Therefore, to detect and correct the errors, additional bits are appended to the data bits at the
time of transmission.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Parity Code
It is easy to include append one parity bit either to the left of MSB or to the right of
LSB of original bit stream. There are two types of parity codes, namely Even Parity
code and Odd Parity code based on the type of parity being chosen.

Even Parity Code


The value of even parity bit should be zero, if even number of ones present in
the binary code. Otherwise, it should be one. So that, even number of ones
present in even parity code. Even parity code contains the data bits and even
parity bit.
The following table shows the even parity codes corresponding to each 3-bit
binary code. Here, the even parity bit is included to the right of LSB of binary
code.
Binary Code Even Parity bit Even Parity Code

000 0 0000

001 1 0011

010 1 0101

011 0 0110

100 1 1001

101 0 1010

110 0 1100

111 1 1111

Here, the number of bits present in the even parity codes is 4. So, the possible
even number of ones in these even parity codes are 0, 2 & 4.
• If the other system receives one of these even parity codes, then there is
no error in the received data. The bits other than even parity bit are same
as that of binary code.
• If the other system receives other than even parity codes, then there will
be an errors in the received data. In this case, we can’t predict the
original binary code because we don’t know the bit positions of error.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Therefore, even parity bit is useful only for detection of error in the received
parity code. But, it is not sufficient to correct the error.

Odd Parity Code


The value of odd parity bit should be zero, if odd number of ones present in the
binary code. Otherwise, it should be one. So that, odd number of ones present
in odd parity code. Odd parity code contains the data bits and odd parity bit.
The following table shows the odd parity codes corresponding to each 3-bit
binary code. Here, the odd parity bit is included to the right of LSB of binary
code.
Binary Code Odd Parity bit Odd Parity Code

000 1 0001

001 0 0010

010 0 0100

011 1 0111

100 0 1000

101 1 1011

110 1 1101

111 0 1110

Here, the number of bits present in the odd parity codes is 4. So, the possible
odd number of ones in these odd parity codes are 1 & 3.
• If the other system receives one of these odd parity codes, then there is
no error in the received data. The bits other than odd parity bit are same
as that of binary code.
• If the other system receives other than odd parity codes, then there is an
errors in the received data. In this case, we can’t predict the original
binary code because we don’t know the bit positions of error.

Therefore, odd parity bit is useful only for detection of error in the received
parity code. But, it is not sufficient to correct the error.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Hamming Code
Hamming code is useful for both detection and correction of error present in the
received data. This code uses multiple parity bits and we have to place these parity bits
in the positions of powers of 2.

The minimum value of 'k' for which the following relation is correct valid is nothing
but the required number of parity bits.
2k≥n+k+1
Where,
‘n’ is the number of bits in the binary code information
‘k’ is the number of parity bits
Therefore, the number of bits in the Hamming code is equal to n + k.

Let the Hamming code is bn+kbn+k−1.....b3b2b1 & parity bits pk,pk−1,....p1.


We can place the ‘k’ parity bits in powers of 2 positions only. In remaining bit positions,
we can place the ‘n’ bits of binary code.

Based on requirement, we can use either even parity or odd parity while forming a
Hamming code. But, the same parity technique should be used in order to find whether
any error present in the received data.

Procedure for finding parity bits :


• Find the value of p1, based on the number of ones present in bit positions b3, b5,
b7 and so on. All these bit positions suffixes in their equivalent binary have ‘1’
in the place value of 20.

• Find the value of p2, based on the number of ones present in bit positions b3, b6,
b7 and so on. All these bit positions suffixes in their equivalent binary have ‘1’
in the place value of 21.

• Find the value of p3, based on the number of ones present in bit positions b5, b6,
b7 and so on. All these bit positions suffixes in their equivalent binary have ‘1’
in the place value of 22.

• Similarly, find other values of parity bits.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

Procedure for finding check bits.


• Find the value of c1, based on the number of ones present in bit positions b1, b3,
b5, b7 and so on. All these bit positions suffixes in their equivalent binary have
‘1’ in the place value of 20.

• Find the value of c2, based on the number of ones present in bit positions b2, b3,
b6, b7 and so on. All these bit positions suffixes in their equivalent binary have
‘1’ in the place value of 21.

• Find the value of c3, based on the number of ones present in bit positions b4, b5,
b6, b7 and so on. All these bit positions suffixes in their equivalent binary have
‘1’ in the place value of 22.

• Similarly, find other values of check bits.

The decimal equivalent of the check bits in the received data gives the value of bit
position, where the error is present. Just complement the value present in that bit
position. Therefore, we will get the original binary code after removing parity bits.

Example: find the Hamming code for binary code, d4d3d2d1 = 1000. Consider even
parity bits.

The number of bits in the given binary code is n=4.

We can find the required number of parity bits by using the following mathematical
relation: 2k ≥ n+k+1

Substitute, n = 4 in the above mathematical relation.


⇒ 2k ≥ 4+k+1
⇒ 2k ≥ 5+k

The minimum value of k that satisfied the above relation is 3. Hence, we require 3 parity
bits p1, p2, and p3. Therefore, the number of bits in Hamming code will be 7, since there
are 4 bits in binary code and 3 parity bits. We have to place the parity bits and bits of
binary code in the Hamming code as shown below.

The 7-bit Hamming code is b7b6b5b4b3b2b1 = d4d3d2p3d1p2bp1

By substituting the bits of binary code, the Hamming code will


be b7b6b5b4b3b2b1=100p3Op2p1.
Now, let us find the parity bits.

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences
THE BHOPAL SCHOOL OF SOCIAL SCIENCES

BCA I-sem : Computer Fundamentals and Architecture Reference Notes

p1 = b7 ⊕ b5 ⊕ b3 = 1 ⊕ 0 ⊕ 0 = 1
p2 = b7 ⊕ b6 ⊕ b3 = 1 ⊕ 0 ⊕ 0 = 1
p3 = b7 ⊕ b6 ⊕ b5 = 1 ⊕ 0 ⊕ 0 = 1

By substituting these parity bits, the Hamming code will be b7b6b5b4b3b2b1 = 1001011

Example: In the above example, we got the Hamming code as b7b6b5b4b3b2b1 =


1001011. Now, let us find the error position when the code received
is b7b6b5b4b3b2b1=1001111

Now, let us find the check bits.


c1 = b7 ⊕ b5 ⊕ b3 ⊕ b1 = 1 ⊕ 0 ⊕ 1 ⊕ 1 = 1
c2 = b7 ⊕ b6 ⊕ b3 ⊕ b2 = 1 ⊕ 0 ⊕ 1 ⊕ 1 = 1
c3 = b7 ⊕ b6 ⊕ b5 ⊕ b4 = 1 ⊕ 0 ⊕ 0 ⊕ 1 = 0

The decimal value of check bits gives the position of error in received Hamming code.
c3c2c1 = (011)2 = (3)10

Therefore, the error present in third bit (b3) of Hamming code. Just complement the
value present in that bit and remove parity bits in order to get the original binary code.

REFERENCES

(1) https://www.javatpoint.com
(2) https://www.tutorialspoint.com
(3) https://www.geeksforgeeks.org

*Edited & Compiled for Students by:


ASHISH JAIN
Assistant Professor
Department of Computer Applications
The Bhopal School of Social Sciences

inprotected.com

You might also like