You are on page 1of 37

Introductionof a Computer

If we look at it in a very broad sense, any digital computer carries out the following five functions:

Step 1 - Takes data as input.

Step 2 - Stores the data/instructions in its memory and uses them as required.

Step 3 - Processes the data and converts it into useful information.

Step 4 - Generates the output.

Step 5 - Controls all the above four steps.

Advantages ofComputers
Following are certain advantages of computers.

High Speed
 Computer is a very fast device.

 It is capable of performing calculation of very large amount of data.

 The computer has units of speed in microsecond, nanosecond, and even the picosecond.It can
perform millions of calculations in a few seconds as compared to man who will spend many
months to perform the same task.
Accuracy
 In addition to being very fast, computers are very accurate.

 The calculations are 100% error free.

 Computers perform all jobs with 100% accuracy provided that the input is correct.

Storage Capability
 Memory is a very important characteristic of computers.
 A computer has much more storage capacity than human beings.
 It can store large amount of data.

 It can store any type of data such as images, videos, text, audio, etc.

Diligence
 Unlike human beings, a computer is free from monotony, tiredness, and lack of concentration.

 It can work continuously without any error and boredom.

 It can perform repeated tasks with the same speed and accuracy.

Versatility
 A computer is a very versatile machine.

 A computer is very flexible in performing the jobs to be done.

 This machine can be used to solve the problems related to various fields.

 At one instance, it may be solving a complex scientific problem and the very next moment it
may be playing a card game.

Reliability
 A computer is a reliable machine.
 Modern electronic components have long lives.
 Computers are designed to make maintenance easy.

Automation
 Computer is an automatic machine.

 Automation is the ability to perform a given task automatically. Once the computer receives a
program i.e., the program is stored in the computer memory, then the program and instruction
can control the program execution without human interaction.

Reduction in Paper Work and Cost


 The use of computers for data processing in an organization leads to reduction in paper work and
results in speeding up the process.

 As data in electronic files can be retrieved as and when required, the problem of maintenance of
large number of paper files gets reduced.

 Though the initial investment for installing a computer is high, it substantially reduces the cost of
each of its transaction.

Disadvantages of Computers

No I.Q.
 A computer is a machine that has no intelligence to perform any task.
 Each instruction has to be given to the computer.
 A computer cannot take any decision on its own.

Dependency
 It functions as per the user’s instruction, thus it is fully dependent on humans.

Environment
 The operating environment of the computer should be dust free and suitable.

No Feeling
 Computers have no feelings or emotions.

 It cannot make judgment based on feeling, taste, experience, and knowledge unlike humans.

COMPUTER APPLICATIONS
Business
A computer has high speed of calculation, diligence,
accuracy, reliability, or versatility which has made it an
integrated part in all business organizations.

Computer is used in business organizations for:


 Payroll calculations
 Budgeting
 Sales analysis
 Financial forecasting
 Managing employee database
 Maintenance of stocks, etc.

Banking
Today, banking is almost totally dependent on
computers.

Banks provide the following facilities:

 Online accounting facility, which includes


checking current balance, making deposits and
overdrafts, checking interest charges, shares,
and trustee records.

 ATM machines which are completely


automated are making it even easier for
customers to deal with banks.

Insurance
Insurance companies are keeping all records up- to-date
with the help of computers. Insurance companies,
finance houses, and stock broking firms are widely using
computers for their concerns.

Insurance companies are maintaining a database of all


clients with information showing:

 Procedure to continue with policies


 Starting date of the policies
 Next due installment of a policy
 Maturity date
 Interests due
 Survival benefits
 Bonus

Education
The computer helps in providing a lot of facilities in the education system.

 The computer provides a tool in the education system known as CBE (Computer Based Education).

 CBE involves control, delivery, and


evaluation of learning.

 Computer education is rapidly increasing the


graph of number of computer students.

 There are a number of methods in which


educational institutions can use a computer to
educate the students.

 It is used to prepare a database about


performance of a student and analysis is carried out on this basis.

Marketing
In marketing, uses of the computer are following:

 Advertising - With computers, advertising


professionals create art and graphics, write and
revise copy, and print and disseminate ads with
the goal of selling more products.

 Home Shopping - Home shopping has been


made possible through the use of computerized
catalogues that provide access to product
information and permit direct entry of orders to
be filled by the customers.

Healthcare
Computers have become an important part in hospitals, labs, and dispensaries. They are being used in
hospitals to keep the record of patients and medicines. It is also used in scanning and diagnosing different
diseases. ECG, EEG, ultrasounds and CT scans, etc. are also done by computerized machines.
Following are some major fields of health care in which computers are used.
Diagnostic System - Computers are used to collect data and identify the cause of illness.

 Lab-diagnostic System - All tests can be done


and the reports are prepared by computer.

 Patient Monitoring System - These are used to


check the patient's signs for abnormality such as
in Cardiac Arrest, ECG, etc.

 Pharma Information System


- Computer is used to check drug labels, expiry
dates, harmful side effects, etc.

 Surgery - Nowadays, computers are also used in performing surgery.

Engineering Design
Computers are widely used for Engineering purpose.

One of the major areas is CAD (Computer Aided Design) that provides creation and modification of
images. Some of the fields are:
 Structural Engineering - Requires stress and
strain analysis for design of ships, buildings,
budgets, airplanes, etc.

 Industrial Engineering - Computers deal


with design, implementation, and
improvement of integrated systems of
people, materials, and equipment.

 Architectural Engineering - Computers help in


planning towns, designing buildings,
determining a range of buildings on a site using
both 2D and 3D drawings.

Military
Computers are largely used in defence. Modern tanks,
missiles, weapons, etc. Military also employs
computerized control systems. Some military areas
where a computer has been used are:

 Missile Control
 Military Communication
 Military Operation and Planning
 Smart Weapons

Communication
Communication is a way to convey a message, an idea, a picture, or speech that is received and
understood clearly and correctly by the person
for whom it is meant. Some main areas in this category are:

 E-mail
 Chatting
 Usenet
 FTP
 Telnet
 Video-conferencing

Government
Computers play an important role in government services. Some major fields in this category are:

 Budgets
 Sales tax department
 Income tax department
 Computation of male/female ratio
 Computerization of voters lists
 Computerization of PAN card
 Weather forecasting

GENERATION OF A COMPUTER

Generation in computer terminology is a change in technology a computer is/was being used. Initially, the
generation term was used to distinguish between varying hardware technologies. Nowadays, generation
includes both hardware and software, which together make up an entire computer system.

There are five computer generations known till date. Each generation has been discussed in detail along
with their time period and characteristics. In the following table, approximate dates against each
generation has been mentioned, which are normally accepted.

Following are the main five generations of computers.

Sr.
No. Generation & Description

First Generation
1
The period of first generation: 1946-1959. Vacuum tube based.

Second Generation
2
The period of second generation: 1959-1965. Transistor based.

Third Generation
3
The period of third generation: 1965-1971. Integrated Circuit based.

Fourth Generation
4
The period of fourth generation: 1971-1980. VLSI microprocessor based.

Fifth Generation
5
The period of fifth generation: 1980-onwards. ULSI microprocessor based.
First Generation Computers

The period of first generation was from 1946-1959. The computers of first generation used vacuum
tubes as the basic components for memory and circuitry for CPU (Central Processing Unit). These tubes,
like electric bulbs, produced a lot of heat and the installations used to fuse

frequently. Therefore, they were very expensive and only large organizations were able to afford it.

In this generation, mainly batch processing operating system was used. Punch cards, paper tape, and
magnetic tape was used as input and output devices. The computers in this generation used machine
code as the programming language.

The main features of the first generation are:

 Vacuum tube technology


 Unreliable
 Supported machine language only
 Very costly
 Generated a lot of heat
 Slow input and output devices
 Huge size
 Need of AC

 Non-portable
 Consumed a lot of electricity

Some computers of this generation were:


 ENIAC
 EDVAC
 UNIVAC
 IBM-701
 IBM-650

Second Generation Computers


The period of second generation was from 1959-1965. In this generation, transistors were used that
were cheaper, consumed less power, more compact in size, more reliable and faster than the first
generation machines made of vacuum tubes. In this generation, magnetic cores were used as the primary
memory and magnetic tape and magnetic disks as secondary storage devices.

In this generation, assembly language and high-level programming languages like FORTRAN, COBOL were
used. The computers used batch processing and multiprogramming operating system.

The main features of second generation are:

 Use of transistors
 Reliable in comparison to first generation computers
 Smaller size as compared to first generation computers
 Generated less heat as compared to first generation computers
 Consumed less electricity as compared to first generation computers
 Faster than first generation computers
 Still very costly
 AC required
 Supported machine and assembly languages
Some computers of this generation were:

 IBM 1620
 IBM 7094
 CDC 1604
 CDC 3600
 UNIVAC 1108

ThirdGeneration Computers
The period of third generation was from 1965-1971. The computers of third generation used Integrated
Circuits (ICs) in place of transistors. A single IC has many transistors, resistors, and capacitors along with
the associated circuitry.

The IC was invented by Jack Kilby. This development made computers smaller in size, reliable, and efficient.
In this generation remote processing, time-sharing, multi-programming operating system were used.
High-level languages (FORTRAN-II TO IV, COBOL, PASCAL PL/1, BASIC, ALGOL-68 etc.) were used during
this generation.
The main features of third generation are:

 IC used
 More reliable in comparison to previous two generations
 Smaller size
 Generated less heat
 Faster
 Lesser maintenance
 Costly
 AC required
 Consumed lesser electricity
 Supported high-level language

Some computers of this generation were:

 IBM-360 series
 Honeywell-6000 series
 PDP (Personal Data Processor)
 IBM-370/168
 TDC-316

Fourth Generation Computers


The period of fourth generation was from 1971-1980. Computers of fourth generation used
Very Large Scale Integrated (VLSI) circuits. VLSI circuits having about 5000 transistors and
other circuit elements with their associated circuits on a single chip made it possible to have
microcomputers of fourth generation.

Fourth generation computers became more powerful, compact, reliable, and affordable. As
a result, it gave rise to Personal Computer (PC) revolution. In this generation, time sharing,
real time networks, distributed operating system were used. All the high-level languages
like C, C++, DBASE etc., were used in this generation.

The main features of fourth generation are:

 VLSI technology used


 Very cheap
 Portable and reliable
 Use of PCs
 Very small size
 Pipeline processing
 No AC required
 Concept of internet was introduced
 Great developments in the fields of networks
 Computers became easily available

Some computers of this generation were:


 DEC 10
 STAR 1000
 PDP 11
 CRAY-1(Super Computer)
 CRAY-X-MP(Super Computer)

Fifth GenerationComputers
The period of fifth generation is 1980-till date. In the fifth generation, VLSI technology became
ULSI (Ultra Large Scale Integration) technology, resulting in the production of microprocessor
chips having ten million electronic components.

This generation is based on parallel processing hardware and AI (Artificial Intelligence)


software. AI is an emerging branch in computer science, which interprets the means and
method of making computers think like human beings. All the high-level languages like C and
C++, Java, .Net etc., are used in this generation.

AI includes:

 Robotics
 Neural Networks
 Game Playing
 Development of expert systems to make decisions in real-life situations
 Natural language understanding and generation

The main features of fifth generation are:


 ULSI technology
 Development of true artificial intelligence
 Development of Natural language processing
 Advancement in Parallel Processing
 Advancement in Superconductor technology
 More user-friendly interfaces with multimedia features
 Availability of very powerful and compact computers at cheaper rates

Some computer types of this generation are:

 Desktop
 Laptop
 NoteBook
 UltraBook
 ChromeBook

TYPES OF COMPUTERS
Computers can be broadly classified by their speed and computing power.

Sr.
No. Type Specifications

PC (Personal It is a single user computer system having moderately powerful


1
Computer) microprocessor

It is also a single user computer system, similar to personal


2 Workstation
computer however has a more powerful microprocessor

It is a multi-user computer system, capable of supporting hundreds


3 Mini Computer
of users simultaneously.

It is a multi-user computer system, capable of supporting


4 Main Frame hundreds of users simultaneously. Software technology is
different from minicomputer.

It is an extremely fast computer, which can execute hundreds of


5 Supercomputer
millions of instructions per second.

PC (Personal Computer)
A PC can be defined as a small, relatively inexpensive computer designed for an individual
user. PCs are based on the microprocessor technology that enables manufacturers to put
an entire CPU on one chip. Businesses use personal
computers for word processing,
accounting, desktop publishing, and for
running spreadsheet and database
management applications. At home, the
most popular use for personal computers
is playing games and surfing the Internet.

Although personal computers are designed


as single-user systems, these systems are
normally linked together to form a
network. In terms of power, now-a-days
high-end models of the Macintosh and PC
offer the same computing power and
graphics capability as low-end workstations
by Sun Microsystems, Hewlett-Packard,
and Dell.
Workstation
Workstation is a computer used for engineering applications (CAD/CAM), desktop
publishing, software development, and other such types of applications which require a
moderate amount of computing power and relatively high quality graphics capabilities.

Workstations generally come with a large, high-resolution graphics screen, large amount of
RAM, inbuilt network support, and a graphical user
interface. Most workstations also have
mass storage device such as a disk drive,
but a special type of workstation, called
diskless workstation, comes without a disk
drive.

Common operating systems for


workstations are UNIX and Windows NT.
Like PC, workstations are also single-user
computers like PC but are typically linked
together to form a local-area network,
although they can also be used as stand-
alone systems.

Minicomputer
It is a midsize multi-processing system capable of supporting up to 250 users simultaneously.

Mainframe
Mainframe is very large in size and is an expensive computer capable of supporting
hundreds or even thousands of users simultaneously. Mainframe executes many programs
concurrently

and supports many simultaneous execution of programs.

Supercomputer
Supercomputers are one of the fastest computers currently available. Supercomputers are
very expensive and are employed for specialized applications that require immense
amount of mathematical calculations (number crunching).

For example, weather forecasting, scientific simulations, (animated) graphics, fluid dynamic
calculations, nuclear energy research, electronic design, and analysis of geological data (e.g.
in petrochemical prospecting)

COMPONENTS OF A DIGITAL COMPUTER

All types of computers follow the same basic logical structure and perform the following five basic
operations for converting raw input data into information useful to their users.

S Operation Description
r
.

N
o
.
The process of entering data and instructions into the computer
1 Take Input
system.

Saving data and instructions so that they are available for


2 Store Data
processing as and when required.

Performing arithmetic, and logical operations on data in order to


3 Processing
convert them into useful information.
Data
Output The process of producing useful information or results for the
4
Information user, such as a printed report or visual display.

Control Directs the manner and sequence in which all of the above
5
the operations are performed.
workf
low

Input Unit
This unit contains devices with the help of which we enter data into the computer. This unit creates a link
between the user and the computer. The input devices translate the information into a form understandable by
the computer.
CPU (Central Processing Unit)
CPU is considered as the brain of the computer. CPU performs all types of data processing operations. It
stores data, intermediate results, and instructions (program). It controls the operation of all parts of the
computer.

CPU itself has the following three components:

 ALU (Arithmetic Logic Unit)


 Memory Unit
 Control Unit

Output Unit
The output unit consists of devices with the help of which we get the information from the computer. This
unit is a link between the computer and the users. Output devices translate the computer's output into a
form understandable by the users.

Types of Programming Languages


There are two types of programming languages, which can be categorized into the following ways:
1. Low level language
a) Machine language (1GL)
b) Assembly language (2GL)
2. High level language
a) Procedural-Oriented language (3GL)
b) Problem-Oriented language (4GL)
c) Natural language (5GL)
1. Low level language
This language is the most understandable language used by computer to perform its operations. It can be
further categorized into:
a) Machine Language (1GL)
Machine language consists of strings of binary numbers (i.e. 0s and 1s) and it is the only one language, the
processor directly understands. Machine language has an Merits of very fast execution speed and
efficient use of primary memory.
Merits:
¨ It is directly understood by the processor so has faster execution time since the programs written in
this language need not to be translated.
¨ It doesn’t need larger memory.
Demerits:
¨ It is very difficult to program using 1GL since all the instructions are to be represented by 0s and 1s.
¨ Use of this language makes programming time consuming.
¨ It is difficult to find error and to debug.
¨ It can be used by experts only.
b) Assembly Language
Assembly language is also known as low-level language because to design a program programmer requires
detailed knowledge of hardware specification. This language uses mnemonics code (symbolic operation
code like ‘ADD’ for addition) in place of 0s and 1s. The program is converted into machine code by
assembler. The resulting program is referred to as an object code.
Merits:
¨ It is makes programming easier than 1GL since it uses mnemonics code for
programming. Eg: ADD for addition, SUB for subtraction, DIV for division, etc.
¨ It makes programming process faster.
¨ Error can be identified much easily compared to 1GL.
¨ It is easier to debug than machine language.
Demerits:
¨ Programs written in this language is not directly understandable by computer so translaters should be
used.
¨ It is hardware dependent language so programmers are forced to think in terms of computer’s
architecture rather than to the problem being solved.
¨ Being machine dependent language, programs written in this language are very less or not protable.
¨ Programmers must know its mnemonics codes to perform any task.
2. High level language
Instructions of this language closely reassembles to human language or English like words. It uses
mathematical notations to perform the task. The high level language is easier to learn. It requires less
time to write and is easier to maintain the errors. The high level language is converted into machine
language by one of the two different languages translator programs; interpreter or compiler.

High level language can be further categorized as:

a) Procedural-Oriented language (3GL)

Procedural Programming is a methodology for modeling the problem being solved, by determining the
steps and the order of those steps that must be followed in order to reach a desired outcome or specific
program state. These languages are designed to express the logic and the procedure of a problem to be
solved. It includes languages such as Pascal, COBOL, C, FORTAN, etc.

Merits:

¨ Because of their flexibility, procedural languages are able to solve a variety of problems.

¨ Programmer does not need to think in term of computer architecture which makes them focused on
the problem.

¨ Programs written in this language are portable.

Demerits:

¨ It is easier but needs higher processor and larger memory.

¨ It needs to be translated therefore its execution time is more.

b) Problem-Oriented language (4GL)


It allows the users to specify what the output should be, without describing all the details of how the data
should be manipulated to produce the result. This is one step ahead from 3GL. These are result oriented
and include database query language.
Eg: Visual Basic, C#, PHP, etc.
The objectives of 4GL are to:
Ø Increase the speed of developing programs.
Ø Minimize user’s effort to obtain information from computer.
Ø Reduce errors while writing programs.
Merits:
¨ Programmer need not to think about the procedure of the program. So, programming is much easier.
Demerits:
¨ It is easier but needs higher processor and larger memory.

¨ It needs to be translated therefore its execution time is more.

c) Natural language (5GL)


Natural language are still in developing stage where we could write statements that would look like normal
sentences.
Merits:
¨ Easy to program.
¨ The programs designed using 5GL will have artificial intelligence (AI).
¨ The programs would be much more interactive and interesting.
Demerits:
¨ It is slower than previous generation language as it should be completely translated into binary code
which is a tedious task.
¨ Highly advanced and expensive electronic devices are required to run programs developed in 5GL. Therefore,
it is an expensive approach.
These are the different types of programming languages with their merits and demerits.

NUMBER SYSTEM

Number system is simply the ways to count things. Aim of any number system is to deal with
certain quantities which can be measured, monitored, recorded, manipulated arithmetically, observed
and utilised. Each quantity has to be represented by its value as efficiently and accurately as is necessary
for any application. The numerical value of a quantity can be basically expressed in either analog
(continuous) or digital (step by step) method of representation. In analog method, a quantity is
expressed by another quantity which is proportional to the first. For example, the voltage output of an
amplifier is measured by a voltmeter. The angular position of the needle of the voltmeter is proportional
to the voltage output of the amplifier.

Digital technology is different from analog technology. Many number systems are being used in
digital technology. Most common amongst them are decimal, binary, octal, and hexadecimal
systems. We are most familiar with the decimal number system, because we use it every day.
It is the base-10 or radix-10 system. Note that there is no symbol for “10” or for the base of
any system. We count 1 2 3 4 5 6 7 8 9, and then insert a 0 in the first column and add a new left
column, starting at 1 again. Then we count 1-9 in the first column again. (People use the base-10
system because we have 10 fingers!). Each column in our system stands for a power of 10 starting
at 100.

1.2 Binary System

All computers use the binary system. The following points provides an overview of the binary system:
• In the binary number system (base of 2), there are only two digits: 0 and 1 and the place values are
20, 21, 22, 23 etc. Binary digits are abbreviated as bits. For example, 1101 is a binary number of 4 bits
(i.e.it is a binary number containing four binary digits.)
• A binary number may have any number of bits. Consider the number 11001.01 1. Note the binary
point (counterpart of decimal point in decimal number system) in this number.
• Each digit is known as a bit and can take only two values 0 and 1. The left most bit is the highest-order
bit and represents the most significant bit (MSB) while the lowest-order bit is the least significant bit
(LSB). Some useful definitions are:
 Word is a binary number consisting of an arbitrary number of bits.
 Nibble is a 4-bit word (one hexadecimal digit) 16 values.
 Byte is an 8-bit word 256 values.

Counting binary numbers

Binary Decimal
Number Number
0000 0
0001 1
0010 2
0100 3
0101 4
0110 5
0111 6
1000 7
1001 8
1010 9
1011 10
1100 11
1’s complement 1101 12
The 1’s complement of 1101 13 a binary number is obtained just by
changing each 0 to 1 1110 14 and each 1 to 0.
1111 15
Binary 1 0 1 1 1 1 0
number 0

1- 0 1 0 0 0 0 1
complemen 1
t
1’s complement

2’s complement
The 2’s complement of a binary number is obtained adding 1 to the 1’s complement of this number:
2’s complement = 1’s complement+1 Binary number 1 0 1 1 1 0 1
0
1’s complement 0 1 0 0 0 1 0 1
+ 1
2’s complement 0 1 0 0 0 1 1 0

There is a simple method to obtain the 2’s complement:


• Beginning with the LSB, just write down bits as they are moving to left till the first 1, including it.
• Substitute the rest of bits by their 1’s complement.

Signed numbers
In a signed number, the left most bit is the so called sign bit: 0=positive number 1=negative number.

Sign-value notation
In this notation, the left-most bit is the sign bit and the others are used to represent the absolute value
notation.

1’s complement
In this notation, the positive numbers have the same representation as the sign-value notation, and
the negative numbers are obtained by taking the 1’s complement of the positive correspondents.

2’s complement
The positive numbers have the same representation as the sign-value notation, and the negative
numbers are obtained by taking the 1’s complement of the positive correspondents.

1.2.1 Binary to Decimal Conversion


• Binary number can be converted into its decimal equivalent, by simply adding the weights of various
positions in the binary number which have bit 1.
• Example 1:
Find the decimal equivalent of the binary number
(11111)2 The equivalent decimal number is
=1X24+1X23+1X22+1X21+1X20
=16+8+4+2+1
= (31)10
• To differentiate between numbers represented in different number systems, either the
corresponding number system may be specified along with the number or a small subscript at the
end of the number may be added signifying the number system. Example (1000)2 represents a binary
number and is not one thousand.
• Example 2:
Consider the conversion of
(100011.101)2 1 0 0 0 1 1.1 0 1
= 25+0+0+0+21+20+2-1+0+2-3
=32+2+1+0.5+0.125
=(35.625)10
Consider the following examples.
1111.00 = 15
11110.0 = 30
111100.0 = 60
From these examples, it is clear that if the binary point is shifted towards right side, then the value of
the number is doubled.
Now consider the following examples.
111.100 =
7.5 11.1
100 = 3.75
1.1 1100 =
1.875
From these examples it is clear that if the binary point is shifted towards the left side, then the value of
the number is halved.

1.3 Decimal to Binary Conversion

A decimal number is converted into its binary equivalent by its repeated divisions by 2. The division is continued
till we get a quotient of 0. Then all the remainders are arranged sequentially with first remainder taking the
position of LSB and the last one taking the position of MSB. Consider the conversion of 27 into its binary
equivalent as follows.
2 27
2 13 - 1
2 6– 1
2 3– 0
2 1- 1
2 0 - 1

If the number also has some figures on the right of the decimal point, then this part of the
number is to be treated separately. Multiply this part repeatedly by two. After first multiplication
by 2, either 1 or 0 will appear on the left of the decimal point. Keep this 1 or 0 separately and do
not multiply it by 2 subsequently. This should be followed for every multiplication. Continue
multiplication by 2 till you get all 0s after the decimal point or up to the level of the accuracy
desired. This will be clear from the following example. Consider the conversion of 27.62510 into
its binary equivalent. We have already converted 27 into its binary equivalent which is (11011)2. Now
for the conversion of 0.625, multiply it by 2 repeatedly as follows:

Thus, 27.62510 = 11011.101

.62
5
X2
1.25
0 .25
0
X2
0.50
0 .50
0
X2
1.00
0 .00
1 0 1 0

Decimal to binary conversion

Let us try another example, conversion of (58.0725)10 into binary. Split this number in two parts, i.e. 58
and .0725 and convert them into binary separately as described above.
2 58
2 -0
2
9
2 -1
14
27 -0
23 -1
21 -1
0 -1
11 1 0 1 0
Decimal to binary conversion
The conversion of 0.725

Thus, (58.0725)10 = 111010.00010

.072
5
X2
0.14 .145
0
50
X2
0.29 .290
00 0
X2
0.580 .580
0
00
X2 .160
1.16 0
00 X2
0.32
0 0 0 1 000

Decimal to binary conversion

Representing numbers in binary is very tedious, since binary numbers often consist of a large chain of 0's and
1's. Convenient shorthand forms for representing the binary numbers are developed such as octal system and
hexadecimal system. With these number systems long strings of 0's and 1's can be reduced to a manageable
form. The section below gives an overview of these systems.

1.4 Octal Number System

The octal number system has base-8 that is, there are 8 digits in this system. These digits are 0, 1, 2, 3, 4, 5, 6, and 7.
The weight of each octal digit is some power of 8 depending upon the position of the digit. Octal numbers showing
positional values (weights) of each digit are as follows:
Octal number does not include the decimal digits 8 and 9. If any number includes decimal digits 8 and 9, then the
number can not be an octal number.

1.4.1 Octal to Decimal Conversion


As has been done in case of binary numbers, an octal number can be converted into its decimal equivalent by
multiplying the octal digit by its positional value. For example, let us convert 36.48 into decimal number.
36.48 = 3 x 81 + 6 x 80 + 4 x 8-1
= 24 + 6 + 0.5
= (30.5)10

1.4.2 Decimal to Octal Conversion


A decimal number can be converted by repeated division by 8 into equivalent octal number. This method is similar
to that adopted in decimal to binary conversion. If the decimal number has some digits on the right of the
decimal point, then this part of the number is converted into its octal equivalent by repeatedly multiplying it by
8. The process is same as has been followed in binary number system. Consider the conversion of 126.3810 into its
decimal equivalent. Split it into two parts, that is 126 and .38

2 126

2 15 -
6

2 1
-7

2 0
-1 1 7 6

Decimal to octal conversion


The conversion of .38 is as follows
Thus, (126.38)10 = 176.3024

.38
X8
3.04 .0
4
X8 .32
0.3 X8
2
2.56 .56
X8
4.48 .4
8

3 0 2 4

Decimal to octal conversion

1.4.3 Octal to Binary Conversion


In the octal number system the highest octal digit i.e.7 can be expressed as a 3-bit binary number. Therefore, all
the octal digits have to be represented by n 3-bit binary number. The binary equivalent of each octal digit is
shown in Table 1.2. The main advantage of the octal number system is the easiness with which any octal
number can be converted into its binary equivalent.

Octal digit 3-bit binary equivalent


0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
Binary equivalent of octal digit

Using this conversion of octal digit into 3-bit binary number, any octal number can be converted into its binary
equivalent by simply replacing each octal digit by a 3-bit binary number. For example, conversion of 567, into its
binary equivalent is:
567 = 101110111
1.4.4 Binary to Octal Conversion
A binary number can be converted into its octal equivalent by first making groups of 3-bits starting from the LSB
side. If the MSB side does not have 3 bits, then add 0s to make the last group of 3 bits. Then by replacing each
group of 3 bits by its octal equivalent, a binary number can be converted into its binary equivalent. For example,
consider the conversion of 1100011001, into its octal equivalent as follows:
= 001 100 01 1 001 [As the MSB side does not have 3 bits, we have added two 0's to make the last group of 3
bits]
=l431

Thus, (1100011001)2 = (1431)8

1.5 Hexadecimal Number System

The hexadecimal number system has base 16 that is it has 16 digits (Hexadecimal means'16'). These digits are 0,
1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. The digits A, B, C, D, E and F have equivalent decimal values 10, 11, 12,
13, 14, and 15 respectively. Each Hex (Hexadecimal is popularly known as hex) digit in a hex number has a
positional value that is some power of 16 depending upon its position in the number.

164 163 162 161 160 16-1 16-2


Weight
Hex Number
1 2 4 A F . B 9

Hex
MSD Point LSD
Fig. 1.7 Hexadecimal number showing positional values (weight) of digits
(Source: http://www.egyankosh.ac.in/bitstream/123456789/10991/1/Unit-10.pdf)

Relationship of hex digits with decimal and binary numbers is given in Table 1.3. Note that to represent the
largest hex digit we require four binary bits. Therefore, the binary equivalent of all the hex digits has to be
written in four bit numbers.

Hex digit Decimal equivalent 4-bit Binary equivalent


0 0 0000
1 1 0001
2 2 0010
3 3 0100
4 4 0101
5 5 0110
6 6 0111
7 7 1000
8 8 1001
9 9 1010
A 10 1011
B 11 1100
C 12 1101
D 13 1101
E 14 1110
F 15 1111
Binary and decimal equivalent of each hex digit
1.5.1 Hex to Decimal Conversion
Hex to decimal conversion is done in the same way as in the cases of binary and octal to decimal conversions. A
hex number is converted into its equivalent decimal number by summing the products of the weights of each
digit and their values. This is clear from the example of conversion of 514.AF16 into its decimal equivalent.

514. AF16 = 5 X 162 + 1 X 161 + 4 X 160 + 10 X 16-1 + 15 X 16-2


= 1280+16+4+0.625+0.0586
= (1300.6836)10

1.5.2 Decimal to Hex Conversion


A decimal number is converted into hex number in the same way as a decimal number is converted into its
equivalent binary and octal numbers. The part of the number on the left of the decimal point is to be divided
repeatedly by 16 and the part an the right of the decimal point is to be repeatedly multiplied by 16. This will be
clear from the examples of conversion of (579.26)10 into hex equivalent. Split the number into two parts, 579
and .26.
Thus, (579)10 = (2443)16

16 579

16 36 -
3

16 2 -
4

-
2
0 2 4 3
Decimal to hex conversion
0 .26 is converted into hex number as follows:

.26
X 16
4.16
.16
X 16
2.56
.56
X 16

8.96

.96

4 2 8
Thus 579.2610 = 243.42816

Decimal to hex conversion

1.5.3 Hex to Binary Conversion


As in octal number system, a hex number is converted into its binary equivalent by replacing each hex digit by
its equivalent 4-bit binary number. This is clear from the following example:

(BA6)16 = B A 6
= 1011 1010 010
= (101110100110)2

1.5.4 Binary to Hex Conversion


By a process that is reverse of the process described in the above section, a binary number can be converted in
to its hex equivalent. Starting from the LSB side, group the binary number bits into groups of lour bits. If towards
the MSB side, the numbers of bits is less than four, then add zeros on the left of the MSB so that the group of
four is complete. Replace each group by its equivalent hex digit. This is clear from the following example:

(1001101110)2 = 0010 0110 1110


=2 6 E
= (26E)16
1.5.5 Hex to Octal Conversion
Each digit of the hex number is first converted into its equivalent four bit binary number. Then the bits of the
equivalent binary number are grouped into groups of three bits. Then each group is replaced by its equivalent
octal digit to get the octal number.
For example:
(5AF)16 = 0101 1010 1111
= 010110101111
=010 110 101 111
=2 6 5 7
=(2567)8

1.5.6 Octal to Hex Conversion


For octal to hex conversion, just reverse the process described in the section
above. This is clear from the following example:
(5457)8 = 101 100 101 111
= 1011 0010 1111
=B 2 F
= (B2F)16

This method can also be applied to hex to decimal and decimal to hex conversions. For example, consider the
conversion of 3C16, into its decimal equivalent:

3C16 = 0011 1100


= 1111002
Check the conversion.
3C16 = 3 X161 + C X160
= 3 x 161+ 12 x 160
= 48 + 12
= (60)10
1111002 = 25+24+23+22
= 32+16+8+4
= (60)10
Thus, 3C16 = (111100)2 = 6010

1.6 Codes

We had an overview of binary, octal and hexadecimal number system. For any number system with n base B and
digits N0 (LSB), N1 N2 ..... N10 (MSB), the decimal equivalent N10 is given by

= N X mBm + .... N X B33+ N < B2 + 2N X B1 + N1 Bo


N 10 0

When numbers, letters or words are represented by a specific group of symbols, it is said that the number, letter or
word is being encoded. The group of symbols is called as the
code. Few codes will be discussed in the following sections.

1.6.1 BCD Code


In BCD (BCD stands Binary coded decimal) code, each digit of a decimal number is converted in to its binary
equivalent. The largest decimal digit is 9; therefore the largest binary equivalent is 1001. This is illustrated as
follows
951 10 = 1001 0101 0001
= (100101010001)BCD
1.6.2 ASCII Code
The word ASCII is run acronym of American Standard Code for Information
Interchange. This is the alphanumeric code most widely used in computers. The
alphanumeric code is one that represents alphabets, numerical numbers,
punctuation marks and other special characters recognised by a computer. The ASCII
code is a 7-bit code representing 26 English alphabets, 0 through 9 digits,
punctuation marks, etc. A 7-bit code has 27 = 128 possible code groups which arc
quite sufficient.

1.6.3 Code Gray


Gray Code is a form of binary that uses a different method of incrementing from one
number to the next. With Gray Code, only one bit changes state from one position
to another. This feature allows a system designer to perform some error checking
(i.e., if more than one bit changes, the data must be incorrect).

Decimal Binary Gray Decimal Binary Gray

0 0000 0000 8 1000 1100

1 0001 0001 9 1001 1101

2 0010 0011 10 1010 1111

3 0011 0010 12 1100 1110

4 0100 0110 13 1101 1010

5 0101 0111 14 1110 1011

6 0110 0101 14 1110 1001

7 0111 0100 15 1111 1000

Gray code

1.6.4 Excess 3
Excess-3 binary-coded decimal (XS-3), also called biased representation or Excess-N,
is a numeral system used on some older computers that uses a pre-specified
number N as a biasing value. It is a way to represent values with a balanced
number of positive and negative numbers. In XS-3, numbers are represented as
decimal digits, and each digit is represented by four bits as the BCD value plus 3
(the "excess" amount)

The smallest binary number represents the smallest value. (i.e. 0 − Excess Value)
The greatest binary number represents the largest value. (i.e. 2N+1 − Excess Value − 1)

The primary advantage of XS-3 coding over BCD coding is that a decimal number
can be 9’s complemented (for subtraction) as easily as a binary number can be 1's
complemented; just invert all bits. In addition, when the sum of two XS-3 digits is
greater than 9, the carry bit of a four bit adder will be set high. This works because,
when adding two numbers that are greater or equal to zero, an "excess" value of
six results in the sum. Since a four bit integer can only hold values 0 to 15, an
excess of six means that any sum over nine will overflow.

1.7 Binary Arithmetic

Majority of arithmetic performed by computers is binary arithmetic, that is, arithmetic on


base two numbers.
Decimal and floating-point numbers, also used in computer arithmetic, depend on binary
representations, and an
understanding of binary arithmetic is necessary in order to understand either one.

Computers perform arithmetic on fixed-size numbers. The arithmetic of fixed size


numbers is called finite-precision arithmetic. The rules for finite-precision
arithmetic are different from the rules of ordinary arithmetic. The sizes of numbers
which can be arithmetic operands are determined when the architecture of the
computer is designed. Common sizes for integer arithmetic are eight, 16, 32, and
recently 64 bits. It is possible for the programmer to perform arithmetic on larger
numbers or on sizes which are not directly implemented in the architecture.
However, this is usually so painful that the programmer picks the most appropriate
size implemented by the architecture. This puts a burden on the computer architect
to select appropriate sizes for integers, and on the programmer to be aware of the
limitations of the size he has chosen and on finite-precision arithmetic in general.

We are considering binary arithmetic in the context of building digital logic circuits to
perform arithmetic. Not only do we have to deal with the fact of finite precision
arithmetic, we must consider the complexity of the digital logic. When there is more
than one way of performing an operation we choose the method which results in
the simplest circuit.

1.7.1 Addition
Addition of binary numbers can be carried out in a similar way by the column
method But before this, view four simple cases. In the decimal number system, 3 +
6 = 9 symbolizes the combination of 3 with 6 to get a total of 9.

View the four simple cases.


• Case 1: When nothing is combined with nothing, we get nothing. The binary
representation of this is 0 + 0 = 0.
• Case 2: When nothing is combined with1, we get1. Using binary numbers to denote this
gives 0 + 1 = 1.
• Case 3: Combining.1 with nothing gives 1. The binary equivalent of this is 1 + 0 = 1.
• Case 4: When we combine 1 with 1, the result is 2. Using binary numbers, we symbolize 1
+ 1 = 10.
The last result is sometimes confusing because of our long time association with
decimal numbers. But it is correct and makes sense because we are using binary
numbers. Binary number 10 stands for'1','0' and not for 10 (ten). To summarize our
results for binary addition,
0+0 = 0
0+1 = 1
1+0 = 1
1+1=10
• One can also express the rules of binary addition with a truth table. This is
important because there are techniques for designing electronic circuits that
compute functions expressed by truth tables. The fact that we can express the
rules of binary addition as a truth table implies that we can design a circuit
which will perform addition on binary numbers, and that turns out to be the
case.
• We only need to write the rules for one column of bits; we start at the right
and apply the rules to each column in succession until the final sum is formed.
Call the bits of the addend and augend A and B, and the carry in from the
previous column Ci. Call the sum S and the carry out Co.
• The truth table for one-bit binary addition looks like this:

A B Ci S Co
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
One-bit binary addition

This says if all three input bits are zero, both S and Co will be zero. If any one of the
bits is one and the other two are zero, S will be one and Co will be zero. If two bits
are 1's, S will be zero and Ci will be one. Only if all three bits are 1's, both S and Co
will be 1's.

1.7.2 Addition of Signed Numbers


Binary addition of 2’s complement signed numbers can be performed using the same
rules given above for unsigned addition. If there is a carry out of the sign bit, it is
ignored. It is possible for the result of an addition to be too large to fit in the
available space. The answer will be truncated, and will be incorrect. This is the
overflow condition discussed above. There are two rules for determining whether
overflow has occurred:
• If two numbers of opposite signs are added, overflow cannot occur.
• If two numbers of the same sign are added, overflow has occurred if and only if the
result is of the opposite
sign.
1.7.3 Subtraction
Addition has the property of being commutative, that is, a+b = b+a. This is not true
of subtraction. 5 – 3 is not the same as 3 – 5. For this reason, we must be careful of
the order of the operands when subtracting. We call the first operand, the number
which is being diminished, the minuend; the second operand, the amount to be
subtracted from the minuend, is the subtrahend. The result is called the difference.

51 minuend
-22 subtrahend
29 difference

It is possible to perform binary subtraction using the same process we use for decimal
subtraction, namely subtracting individual digits and borrowing from the left. This
process quickly becomes cumbersome as you borrow across successive zeroes in
the minuend. Further, it doesn’t lend itself well to automation. Jacobowitz describes
the “carry” method of subtraction which some of you may have learned in
elementary school, where a one borrowed in the minuend is “paid back” by adding
to the subtrahend digit to the left. This means that one need look no more than
one column to the left when subtracting.

Subtraction can thus be performed a column at a time with a carry to the left,
analogous to addition. This is a process which can be automated, but we are left
with difficulties when the subtrahend is larger than the minuend or when either
operand is, signed. Since we can form the complement of a binary number easily and
can add signed numbers easily, the obvious answer to the problem of subtraction is
to take the 2’s complement of the subtrahend, then add it to the minuend. That is
51–22 = 51+ (–22).

Not only does this approach remove many of the complications of subtraction by the
usual method, but it also means special circuits to perform subtraction need not be
built All that is needed is a circuit which can form the bitwise complement of a
number and an adder.

1.7.4 Multiplication
A simplistic way to perform multiplication is by repeated addition. In the example
below, we could add 42 to the product register 27 times. In fact, some early
computers performed multiplication this way. However, one of our goals is speed,
and we can do much better using the familiar methods we have learned for
multiplying decimal numbers. Recall that the multiplicand is multiplied by each
digit of the multiplier to form a partial product, and then the partial products are
added to form the total product. Each partial product is shifted left to align on the
right with its multiplier digit.
42 multiplicand
x 27 multiplier
294 first partial product (42 X 7)
84
second
partial
product
(42 X 2)
1134
total
product

Binary multiplication of unsigned (or positive 2’s complement) numbers works


exactly the same way, but is even easier because the digits of the multiplier are all
either zero or one. That means the partial products are either zero or a copy of the
multiplicand, shifted left appropriately. Consider the following binary
multiplication:

0111 multiplicand
x 0101 multiplier
0111 first partial product (0111 X 1)
0000 second partial product (0111 X 0)
0111 third partial product (0111 X 1)
0000 fourth partial products (0111 X 0)
0100011 total product

Notice that no true multiplication is necessary in forming the partial products. The
fundamental operations required are shifting and addition. This means we can
multiply unsigned or positive integers using only shifters and adders.

1.7.5 Division
As with the other arithmetic operations, division is based on the paper-and-pencil
approach we learned for decimal arithmetic. We will show an algorithm for unsigned
long division that is essentially similar to the decimal algorithm we learned in grade
school. Let us divide 0110101 (5310) by 0101 (510). Beginning at the left of the
dividend, we move to the right one digit at a time until we have identified a portion
of the dividend which is greater than or equal to the divisor. At this point, a one is
placed in the quotient; all digits of the quotient to the left are assumed to be zero.
The divisor is copied below the partial dividend and subtracted to produce a partial
remainder as shown below.

1 quotient
divisor 0101
0110101
dividend
0101
1 partial remainder
Now digits from the dividend are “brought down” into the partial remainder until
the partial remainder is again greater than or equal to the divisor. Zeroes are placed
in the quotient until the partial remainder is greater than or equal to the divisor,
and then a one is placed in the quotient, as shown below.

101
0101 011010
1
0101
110

The divisor is copied below the partial remainder and subtracted from it to form a
new partial remainder. The process is repeated until all bits of the dividend have
been used. The quotient is complete and the result of the last subtraction is the
remainder.

1010
0101 0110101
0101
110
0101
11

This completes the division. The quotient is (1010)2 (1010) and the remainder is (11)2
(310), which is the expected result. This algorithm works only for unsigned numbers,
but it is possible to extend it to 2’s complement numbers.
Multiple choice questions:
1. Aim of any number system is to deal with certain quantities which can be measured,
monitored, _____, manipulated arithmetically, observed and utilised.
a. recorded
b. stored
c. read
d. used

2. Which of the following is not a common number system?


a. Decimal system
b. Tetra decimal system
c. Binary system
d. Octal systems

3. What are binary digits abbreviated as?


a. Bytes
b. Giga bytes
c. Bits
d. Nibble

4. The 2’s complement of a binary number is obtained adding 1 to the of


this number.
a. complement
b. end
c. beginning
d. 1’s complement

5. Binary number can be converted into its decimal equivalent by simply adding _____of
various positions in the binary number which has bit 1.
a. weights
b. number
c. ten
d. two

6. A decimal number is converted into its binary equivalent by its repeated by 2.


a. addition
b. division
c. multiplication
d. subtraction

7. Advantage of the octal number system is the ease with which any octal number can be
converted into its____ equivalent.
a. decimal
b. hex
c. binary
d. tetra

8. Which digits are excluded from the octal number system?


a. 1 and 2
b. 0 and 1
c. 7 and 8
d. 8 and 9

9. What should be added to last group of 3 bits if the MSB side does not have 3
bits while converting numbers from binary to octal?
a. Zero
b. One
c. Two
d. Nine
10. In subtraction number which is being diminished is called the minuend; the
amount to be subtracted from the minuend is the called the .
a. difference
b. subtrahend
c. subtraction
d. minus

You might also like