Вы находитесь на странице: 1из 36

UNIT 1

INTRODUCTION TO COMPUTER SYSTEM

What is Computer?
The term computer is derived from the Latin term ‘computare’; this means
to calculate means a computer is nothing but a machine which can calculate.
Or
A computer is an electronic device that manipulates information, or data. It has the
ability to store, retrieve, and process data. 

Inventor of Computer
Charles Babbage, an English mechanical engineer and polymath, originated the
concept of a programmable computer. Considered the "father of the computer" he
conceptualized and invented the first mechanical computer in the early 19th century.

Functionalities of computer
There are basically for basic functions of computers - input, storage, processing and
output. These are described below:
Input: Receiving or accepting information from outside sources. The most common
way of performing this function is through the information entered through the
keyboard and the click of mouse. Of course there are many other type of devices for
receiving such information - for example, the web cam, DVD Disk and pen drive etc.
Storage: Store information in the computer. The memory is classify in two broad
categories. First is the memory in the central processing unit of the computer, and
second is the auxiliary memory. The auxiliary memory includes devices such as fixed
hard drives.
Processing: This is really the core of computer operation. The computer processes
the data that is fed to the computer by various means and the data already contained
in internal memory to produce the results that is the core of all computer application.
Output: The results of the processing are made available for use by any user or other
devices. The most common ways of producing such outputs are through computer
monitor, speakers, and printers. When a computer is connected to other devices,
including through Internet, this output is in the form of electrical pulses. The output
data can also be recorded on to an external recording medium such as a DVD disk.

Advantages of Computer
The advantages of computer are given below:

1. Stores data in digital format: Computers can store millions of pages of


information in digital format.
2. Huge storage: We can store huge information. The present day hard-disks can
store 100s of Gigabytes (GB) of information. Large businesses store their
marketing and sales data in their computer systems. Even sensitive data
of customers are securely protected in a computerized environment.
3. Play games: When it comes to games, the choices are almost unlimited.
4. Calculations: Businesses are increasingly using spreadsheets and other
software as a tool for performing mathematical calculations.
5. Prepare and store official documents: You can use a word processing
software to prepare, edit and save any text document. The concept of
paperless offices is finally taking its shape. excel- calculations
6. Presentations: If your office demands that you prepare presentations, you can
prepare it in a PowerPoint.
7. Internet: You can connect your computer to Internet and browse through huge
data.  People use internet for various purposes. Students can use internet to
download study materials. A research analyst can do market research over
internet. A marketing person can gather relevant data across various
geographical boundaries. A prospective customer can find a service provider
over internet.
8. Multimedia: Computer can also be used as an entertainment device. We can
play various multimedia applications such as music, video, etc.
9. Prepare books of accounts: With the help of accounting software, we can
prepare our books of accounts.
10. Reduced cost: The introduction of computer has resulted into a reduction of
cost to perform various complicated tasks.

Disadvantages of Computer
The disadvantages of computer are given below:

1. Ever changing technology: The technology that is new today, may


soon become obsolete. We need to regularly upgrade the hardware and
software in a computerized environment. This involves additional time and
cost.
2. Increased manpower cost: The computer needs to be operated by skilled
person. This has led to an increase in manpower cost for organizations. Due
to the inherent risks, huge expenditure are made ensure data security.
3. Computer stops responding: At times the operating system of the computer
may stop responding or functioning. Though this problem is generally solved
by restarting the computer, but sometimes you may have to take the support
of the technician.
4. Viruses: The threat of virus and malware attack always remains in the
computerized environment. To cope up with these risks, various anti-virus
software are available in the market. If you are using a good antivirus, you are
almost sure that your private information and other sensitive data are
secured.
5. Reduction in employment opportunity: The introduction of computers has
negatively impacted the employability of computer illiterate people.

Applications of Computer

1. Business A computer has high speed of calculation, diligence, accuracy,


reliability, or versatility which made it an integrated part in all business
organisations.
Computer is used in business organisations for:
 Payroll calculations
 Budgeting
 Sales analysis
 Financial forecasting
 Managing employees database
 Maintenance of stocks etc.

2. Banking Today banking is almost totally dependent on computer. Banks


provide following facilities:
 Banks provide online accounting facility, which includes current balances,
deposits, overdrafts, interest charges, shares, and trustee records.
 ATM machines are making it even easier for customers to deal with banks.

3. Insurance Insurance companies are keeping all records up-to-date with the
help of computers. The 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

4. Education The computer has provided 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.
 The computer education is rapidly increasing the graph of number of
computer students.
 There are number of methods in which educational institutions can use
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.

5. Marketing In marketing, uses of 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.
 At Home Shopping - Home shopping has been made possible through use of
computerised catalogues that provide access to product information and
permit direct entry of orders to be filled by the customers.

6. Health Care Computers have become important part in hospitals, labs, and
dispensaries. The computers 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 computerised machines. Some major fields of health care in which
computers are used are:
 Diagnostic System - Computers are used to collect data and identify cause of
illness.
 Lab-diagnostic System - All tests can be done and reports are prepared by
computer.
 Patient Monitoring System - These are used to check patient's signs for
abnormality such as in Cardiac Arrest, ECG etc.
 Pharma Information System - Computer checks Drug-Labels, Expiry dates,
harmful drug’s side effects etc.
 Surgery : Nowadays, computers are also used in performing surgery.

7. Engineering Design Computers are widely used in Engineering purpose. One of


major areas is CAD (Computer aided design). That provides creation and
modification of images. Some 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 equipments.
 Architectural Engineering - Computers help in planning towns, designing
buildings, determining a range of buildings on a site using both 2D and 3D
drawings.
8. Military Computers are largely used in defence. Modern tanks, missiles,
weapons etc. Military also employs computerised control systems. Some
military areas where a computer has been used are:
 Missile Control
 Military Communication
 Military Operation and Planning
 Smart Weapons

9. Communication Communication means 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 for. Some main areas in this category are:
 E-mail
 Chatting
 Usenet
 FTP
 Telnet
 Video-conferencing

10. Government Computers play an important role in government. Some major


fields in this category are:
 Budgets
 Sales tax department
 Income tax department
 Male/Female ratio
 Computerization of voters lists
 Computerization of driving licensing system
 Computerization of PAN card
 Weather forecasting

Computer Generations
There are totally five computer generations known till date.

The period of first generation was 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
were prone to frequent fusing of the installations, therefore, were very expensive and
could be afforded only by very large organisations. In this generation mainly batch
processing operating system were used. Punched cards, paper tape, and magnetic
tape were used as input and output devices. The computers in this generation used
machine code as programming language.

The main features of first generation are:


 Vacuum tube technology
 Unreliable
 Supported machine language only
 Very costly
 Generated lot of heat
 Slow input and output devices
 Huge size
 Need of A.C.
 Non-portable
 Consumed lot of electricity
Some computers of this generation were:
 ENIAC
 EDVAC
 UNIVAC
 IBM-701
 IBM-650

The period of second generation was 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 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
 A.C. needed
 Supported machine and assembly languages
Some computers of this generation were:
 IBM 1620
 IBM 7094
 CDC 1604
 CDC 3600
 UNIVAC 1108

The period of third generation was 1965-1971. The computers of third generation
used integrated circuits (IC's) 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
 Still costly
 A.C needed
 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

The period of fourth generation was 1971-1980. The computers of fourth generation
used Very Large Scale Integrated (VLSI) circuits. VLSI circuits having about 5000
transistors and other circuit elements and 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 PC's
 Very small size
 Pipeline processing
 No A.C. needed
 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)

The period of fifth generation is 1980-till date. In the fifth generation, the 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 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

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


Computer) powerful microprocessor

2 WorkStation It is also a single user computer system which is


similar to personal computer but have more powerful
microprocessor.

3 Mini Computer It is a multi-user computer system which is capable of


supporting hundreds of users simultaneously.

4 Main Frame It is a multi-user computer system which is capable of


supporting hundreds of users simultaneously.
Software technology is different from minicomputer.

5 Supercomputer It is an extremely fast computer which can execute


hundreds of millions of instructions per second.

Basic Structure / computer components

Input Unit
This unit contains devices with the help of which we enter data into computer. This
unit makes link between user and computer. The input devices translate the
information into the form understandable by 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 computer.
CPU itself has following three components
 ALU(Arithmetic Logic Unit)
 Memory Unit
 Control Unit

Output Unit
Output unit consists of devices with the help of which we get the information from
computer. This unit is a link between computer and users. Output devices translate
the computer's output into the form understandable by users.
CPU consists of the following features:
 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 computer.
CPU itself has following three components.
 Memory or Storage Unit
 Control Unit
 ALU(Arithmetic Logic Unit)

Memory or Storage Unit


This unit can store instructions, data and intermediate results. This unit supplies
information to the other units of the computer when needed. It is also known as
internal storage unit or main memory or primary storage or Random access
memory(RAM).
Its size affects speed, power and capability. Primary memory and secondary
memory are two types of memories in the computer. Functions of memory unit are:
 It stores all the data and the instructions required for processing.
 It stores intermediate results of processing.
 It stores final results of processing before these results are released to an
output device.
 All inputs and outputs are transmitted through main memory.
Control Unit
This unit controls the operations of all parts of computer but does not carry out any
actual data processing operations.
Functions of this unit are:
 It is responsible for controlling the transfer of data and instructions among
other units of a computer.
 It manages and coordinates all the units of the computer.
 It obtains the instructions from the memory, interprets them, and directs the
operation of the computer.
 It communicates with Input/Output devices for transfer of data or results
from storage.
 It does not process or store data.

ALU(Arithmetic Logic Unit)


This unit consists of two subsections namely
 Arithmetic section
 Logic Section
Arithmetic Section
Function of arithmetic section is to perform arithmetic operations like addition,
subtraction, multiplication and division. All complex operations are done by making
repetitive use of above operations.
Logic Section
Function of logic section is to perform logic operations such as comparing,
selecting, matching and merging of data.

Input Devices
Following are few of the important input devices which are used in a computer:
 Keyboard
 Mouse
 Joy Stick
 Light pen
 Track Ball
 Scanner
 Microphone
 Bar Code Reader

Keyboard
Keyboard is the most common and very popular input device which helps in
inputting data to the computer.
Keyboards are of two sizes 84 keys or 101/102 keys, but now keyboards with 104
keys or 108 keys are also available for Windows and Internet.

The keys on the keyboard are as follows:


Sr.No Keys Description

1 Typing Keys These keys include the letter keys (A-Z) and digit
keys (0-9) which generally give same layout as that
of typewriters.

2 Numeric Keypad It is used to enter numeric data or cursor


movement. Generally, it consists of a set of 17
keys that are laid out in the same configuration
used by most adding machines and calculators.

3 Function Keys The twelve function keys are present on the


keyboard which are arranged in a row at the top of
the keyboard. Each function key has unique
meaning and is used for some specific purpose.

4 Control keys These keys provide cursor and screen control. It


includes four directional arrow keys. Control keys
also include Home, End, Insert, Delete, Page Up,
Page Down, Control(Ctrl), Alternate(Alt),
Escape(Esc).

5 Special Purpose Keyboard also contains some special purpose


Keys keys such as Enter, Shift, Caps Lock, Num Lock,
Space bar, Tab, and Print Screen.

Mouse
Mouse is most popular pointing device. It is a very famous cursor-control device
having a small palm size box with a round ball at its base which senses the
movement of mouse and sends corresponding signals to CPU when the mouse
buttons are pressed.
Generally it has two buttons called left and right button and a wheel is present
between the buttons. Mouse can be used to control the position of cursor on
screen, but it cannot be used to enter text into the computer.

Joystick
Joystick is also a pointing device which is used to move cursor position on a
monitor screen. It is a stick having a spherical ball at its both lower and upper ends.
The lower spherical ball moves in a socket. The joystick can be moved in all four
directions. The function of joystick is similar to that of a mouse. It is mainly used in
Computer Aided Designing(CAD) and playing computer games.

Light Pen
Light pen is a pointing device which is similar to a pen. It is used to select a
displayed menu item or draw pictures on the monitor screen. It consists of a
photocell and an optical system placed in a small tube. When the tip of a light pen is
moved over the monitor screen and pen button is pressed, its photocell sensing
element detects the screen location and sends the corresponding signal to the CPU.

Track Ball
Track ball is an input device that is mostly used in notebook or laptop computer,
instead of a mouse. This is a ball which is half inserted and by moving fingers on
ball, pointer can be moved. Since the whole device is not moved, a track ball
requires less space than a mouse. A track ball comes in various shapes like a ball, a
button and a square.

Scanner
Scanner is an input device which works more like a photocopy machine. It is used
when some information is available on a paper and it is to be transferred to the hard
disc of the computer for further manipulation. Scanner captures images from the
source which are then converted into the digital form that can be stored on the disc.
These images can be edited before they are printed

Microphone
Microphone is an input device to input sound that is then stored in digital form. The
microphone is used for various applications like adding sound to a multimedia
presentation or for mixing music.

Bar Code Readers


Bar Code Reader is a device used for reading bar coded data (data in form of light
and dark lines). Bar coded data is generally used in labelling goods, numbering the
books etc. It may be a hand held scanner or may be embedded in a stationary
scanner. Bar Code Reader scans a bar code image, converts it into an alphanumeric
value which is then fed to the computer to which bar code reader is connected.

Output Devices
Following are few of the important output devices which are used in a computer.
 Monitors
 Graphic Plotter
 Printer

Monitors
Monitors, commonly called as Visual Display Unit (VDU), are the main output device
of a computer. It forms images from tiny dots, called pixels that are arranged in a
rectangular form. The sharpness of the image depends upon the number of pixels.
There are two kinds of viewing screen used for monitors.
 Cathode-Ray Tube (CRT)
 Flat- Panel Display

Cathode-Ray Tube (CRT) Monitor


The CRT display is made up of small picture elements called pixels. The smaller the
pixels, the better the image clarity, or resolution. It takes more than one illuminated
pixel to form whole character, such as the letter ‘e’ in the word help. A finite number
of characters can be displayed on a screen at once. The screen can be divided into
a series of character boxes - fixed location on the screen where a standard
character can be placed. Most screens are capable of displaying 80 characters of
data horizontally and 25 lines vertically. There are some disadvantages of CRT:
 Large in Size
 High power consumption

Flat-Panel Display Monitor


The flat-panel display refers to a class of video devices that have reduced volume,
weight and power requirement in comparison to the CRT. You can hang them on
walls or wear them on your wrists. Current uses of flat-panel displays include
calculators, video games, monitors, laptop computer, graphics display.
The flat-panel display is divided into two categories:
 Emissive Displays - The emissive displays are devices that convert electrical
energy into light. Example are plasma panel and LED(Light-Emitting Diodes).
 Non-Emissive Displays - The Non-emissive displays use optical effects to
convert sunlight or light from some other source into graphics patterns.
Example is LCD(Liquid-Crystal Device)

Printers
Printer is an output device, which is used to print information on paper.
There are two types of printers:
 Impact Printers
 Non-Impact Printers
Impact Printers
The impact printers print the characters by striking them on the ribbon which is then
pressed on the paper.
Characteristics of Impact Printers are the following:
 Very low consumable costs
 Very noisy
 Useful for bulk printing due to low cost
 There is physical contact with the paper to produce an image
These printers are of two types
 Character printers
 Line printers
Character Printers
Character printers are the printers which print one character at a time.
These are further divided into two types:
 Dot Matrix Printer(DMP)
 Daisy Wheel
DOT MATRIX PRINTER
In the market one of the most popular printers is Dot Matrix Printer. These printers
are popular because of their ease of printing and economical price. Each character
printed is in form of pattern of dots and head consists of a Matrix of Pins of size
(5*7, 7*9, 9*7 or 9*9) which come out to form a character that is why it is called Dot
Matrix Printer.
Advantages
 Inexpensive
 Widely Used
 Other language characters can be printed
Disadvantages
 Slow Speed
 Poor Quality

DAISY WHEEL
Head is lying on a wheel and pins corresponding to characters are like petals of
Daisy (flower name) that is why it is called Daisy Wheel Printer. These printers are
generally used for word-processing in offices which require a few letters to be sent
here and there with very nice quality.
Advantages
 More reliable than DMP
 Better quality
 The fonts of character can be easily changed
Disadvantages
 Slower than DMP
 Noisy
 More expensive than DMP

Line Printers
Line printers are the printers which print one line at a time.
These are of further two types
 Drum Printer
 Chain Printer
DRUM PRINTER
This printer is like a drum in shape so it is called drum printer. The surface of drum
is divided into number of tracks. Total tracks are equal to size of paper i.e. for a
paper width of 132 characters, drum will have 132 tracks. A character set is
embossed on track. The different character sets available in the market are 48
character set, 64 and 96 characters set. One rotation of drum prints one line. Drum
printers are fast in speed and can print 300 to 2000 lines per minute.
Advantages
 Very high speed
Disadvantages
 Very expensive
 Characters fonts cannot be changed
CHAIN PRINTER
In this printer, chain of character sets is used so it is called Chain Printer. A
standard character set may have 48, 64, or 96 characters.
Advantages
 Character fonts can easily be changed.
 Different languages can be used with the same printer.
Disadvantages
 Noisy

Non-impact Printers
Non-impact printers print the characters without using ribbon. These printers print a
complete page at a time so they are also called as Page Printers.
These printers are of two types
 Laser Printers
 Inkjet Printers
Characteristics of Non-impact Printers
 Faster than impact printers.
 They are not noisy.
 High quality.
 Support many fonts and different character size.
Laser Printers
These are non-impact page printers. They use laser lights to produce the dots
needed to form the characters to be printed on a page.
ADVANTAGES
 Very high speed
 Very high quality output
 Give good graphics quality
 Support many fonts and different character size
DISADVANTAGES
 Expensive.
 Cannot be used to produce multiple copies of a document in a single printing.

Inkjet Printers
Inkjet printers are non-impact character printers based on a relatively new
technology. They print characters by spraying small drops of ink onto paper. Inkjet
printers produce high quality output with presentable features.
They make less noise because no hammering is done and these have many styles
of printing modes available. Colour printing is also possible. Some models of Inkjet
printers can produce multiple copies of printing also.
ADVANTAGES
 High quality printing
 More reliable
DISADVANTAGES
 Expensive as cost per page is high
 Slow as compared to laser printer

MEMORY
A memory is just like a human brain. It is used to store data and instructions.
Computer memory is the storage space in computer where data is to be processed
and instructions required for processing are stored. The memory is divided into
large number of small parts called cells. Each location or cell has a unique address
which varies from zero to memory size minus one. For example if computer has 64k
words, then this memory unit has 64 * 1024=65536 memory locations. The address
of these locations varies from 0 to 65535.
Memory is primarily of three types
 Cache Memory
 Primary Memory/Main Memory
 Secondary Memory
Cache Memory
Cache memory is a very high speed semiconductor memory which can speed up
CPU. It acts as a buffer between the CPU and main memory. It is used to hold those
parts of data and program which are most frequently used by CPU. The parts of
data and programs are transferred from disk to cache memory by operating system,
from where CPU can access them.
Advantages
The advantages of cache memory are as follows:
 Cache memory is faster than main memory.
 It consumes less access time as compared to main memory.
 It stores the program that can be executed within a short period of time.
 It stores data for temporary use.

Disadvantages
The disadvantages of cache memory are as follows:
 Cache memory has limited capacity.
 It is very expensive.

Primary Memory (Main Memory)


Primary memory holds only those data and instructions on which computer is
currently working. It has limited capacity and data is lost when power is switched
off. It is generally made up of semiconductor device. These memories are not as
fast as registers. The data and instruction required to be processed reside in main
memory. It is divided into two subcategories RAM and ROM.
Characteristics of Main Memory
 These are semiconductor memories
 It is known as main memory.
 Usually volatile memory.
 Data is lost in case power is switched off.
 It is working memory of the computer.
 Faster than secondary memories.
 A computer cannot run without primary memory.
Secondary Memory
This type of memory is also known as external memory or non-volatile. It is slower
than main memory. These are used for storing data/Information permanently. CPU
directly does not access these memories instead they are accessed via input-output
routines. Contents of secondary memories are first transferred to main memory,
and then CPU can access it. For example : disk, CD-ROM, DVD etc.
Characteristic of Secondary Memory
 These are magnetic and optical memories
 It is known as backup memory.
 It is non-volatile memory.
 Data is permanently stored even if power is switched off.
 It is used for storage of data in a computer.
 Computer may run without secondary memory.
 Slower than primary memories.

RAM(Random Access Memory) is the internal memory of the CPU for storing data,
program and program result. It is read/write memory which stores data until the
machine is working. As soon as the machine is switched off, data is erased. Access
time in RAM is independent of the address that is, each storage location inside the
memory is as easy to reach as other locations and takes the same amount of time.
Data in the RAM can be accessed randomly but it is very expensive. RAM is volatile,
i.e. data stored in it is lost when we switch off the computer or if there is a power
failure. Hence a backup uninterruptible power system(UPS) is often used with
computers. RAM is small, both in terms of its physical size and in the amount of
data it can hold.
RAM is of two types
 Static RAM (SRAM)
 Dynamic RAM (DRAM)

Static RAM (SRAM)


The word static indicates that the memory retains its contents as long as power is
being supplied. However, data is lost when the power gets down due to volatile
nature. SRAM chips use a matrix of 6-transistors and no capacitors. Transistors do
not require power to prevent leakage, so SRAM need not have to be refreshed on a
regular basis.
Because of the extra space in the matrix, SRAM uses more chips than DRAM for the
same amount of storage space, thus making the manufacturing costs higher. So
SRAM is used as cache memory and has very fast access.
Characteristic of the Static RAM
 It has long life
 There is no need to refresh
 Faster
 Used as cache memory
 Large size
 Expensive
 High power consumption

Dynamic RAM (DRAM)


DRAM, unlike SRAM, must be continually refreshed in order to maintain the data.
This is done by placing the memory on a refresh circuit that rewrites the data
several hundred times per second. DRAM is used for most system memory
because it is cheap and small. All DRAMs are made up of memory cells which are
composed of one capacitor and one transistor.
Characteristics of the Dynamic RAM
 It has short data lifetime
 Need to be refreshed continuously
 Slower as compared to SRAM
 Used as RAM
 Lesser in size
 Less expensive
 Less power consumption
ROM stands for Read Only Memory. The memory from which we can only read but
cannot write on it. This type of memory is non-volatile. The information is stored
permanently in such memories during manufacture. A ROM, stores such
instructions that are required to start a computer. This operation is referred to as
bootstrap. ROM chips are not only used in the computer but also in other electronic
items like washing machine and microwave oven.

Following are the various types of ROM


MROM (Masked ROM)
The very first ROMs were hard-wired devices that contained a pre-programmed set
of data or instructions. These kind of ROMs are known as masked ROMs which are
inexpensive.
PROM (Programmable Read only Memory)
PROM is read-only memory that can be modified only once by a user. The user buys
a blank PROM and enters the desired contents using a PROM program. Inside the
PROM chip there are small fuses which are burnt open during programming. It can
be programmed only once and is not erasable.
EPROM(Erasable and Programmable Read Only Memory)
The EPROM can be erased by exposing it to ultra-violet light for a duration of up to
40 minutes. Usually, an EPROM eraser achieves this function. During programming,
an electrical charge is trapped in an insulated gate region. The charge is retained for
more than ten years because the charge has no leakage path. For erasing this
charge, ultra-violet light is passed through a quartz crystal window(lid). This
exposure to ultra-violet light dissipates the charge. During normal use the quartz lid
is sealed with a sticker.
EEPROM(Electrically Erasable and Programmable Read Only Memory)
The EEPROM is programmed and erased electrically. It can be erased and
reprogrammed about ten thousand times. Both erasing and programming take
about 4 to 10 ms (milli second). In EEPROM, any location can be selectively erased
and programmed. EEPROMs can be erased one byte at a time, rather than erasing
the entire chip. Hence, the process of re-programming is flexible but slow.
Advantages of ROM
The advantages of ROM are as follows:
 Non-volatile in nature
 These cannot be accidentally changed
 Cheaper than RAMs
 Easy to test
 More reliable than RAMs
 These are static and do not require refreshing
 Its contents are always known and can be verified

Memory unit is:


 the amount of data that can be stored in the storage unit.
 that in which storage capacity is expressed in terms of Bytes.
Following are the main memory storage units:
Sr.No. Unit Description

1 Bit (Binary Digit) A binary digit is logical 0 and 1 representing a passive


or an active state of a component in an electric
circuit.

2 Nibble A group of 4 bits is called nibble.

3 Byte A group of 8 bits is called byte. A byte is the smallest


unit which can represent a data item or a character.

4 Word A computer word, like a byte, is a group of fixed


number of bits processed as a unit which varies
from computer to computer but is fixed for each
computer.
The length of a computer word is called word-size or
word length and it may be as small as 8 bits or may
be as long as 96 bits. A computer stores the
information in the form of computer words.

Few higher storage units are following


Sr.No. Unit Description

1 Kilobyte (KB) 1 KB = 1024 Bytes

2 Megabyte (MB) 1 MB = 1024 KB

3 GigaByte (GB) 1 GB = 1024 MB

4 TeraByte (TB 1 TB = 1024 GB

5 PetaByte (PB) 1 PB = 1024 TB

Motherboard
The motherboard serves as a single platform to connect all of the parts of a
computer together. A motherboard connects CPU, memory, hard drives, optical
drives, video card, sound card, and other ports and expansion cards directly or via
cables. It can be considered as the backbone of a computer.

Features of Motherboard
A motherboard comes with following features:
 Motherboard varies greatly in supporting various types of components.
 Normally a motherboard supports a single type of CPU and few types of
memories.
 Video Cards, Hard disks, Sound Cards have to be compatible with
motherboard to function properly
 Motherboards, cases and power supplies must be compatible to work
properly together.
Popular Manufacturers
 Intel
 ASUS
 AOpen
 ABIT
 Biostar
 Gigabyte
 MSI
Description of Motherboard
The motherboard is mounted inside the case and is securely attached via small
screws through pre-drilled holes. Motherboard contains ports to connect all of the
internal components. It provides a single socket for CPU whereas for memory,
normally one or more slots are available. Motherboards provide ports to attach
floppy drive, hard drive, and optical drives via ribbon cables. Motherboard carries
fans and a special port designed for power supply.
There is a peripheral card slot in front of the motherboard using which video cards,
sound cards and other expansion cards can be connected to motherboard.
On the left side, motherboards carry a number of ports to connect monitor, printer,
mouse, keyboard, speaker, and network cables. Motherboards also provide USB
ports which allow compatible devices to be connected in plug-in/plug-out fashion
for example, pen drive, digital cameras etc.

PORT
A port:
 is a physical docking point using which an external device can be connected
to the computer.
 can also be programmatic docking point through which information flows
from a program to computer or over the internet.
Following are few important types of ports:
Serial Port
 Used for external modems and older computer mouse
 Two versions : 9 pin, 25 pin model
 Data travels at 115 kilobits per second
Parallel Port
 Used for scanners and printers
 Also called printer port
 25 pin model
 Also known as IEEE 1284-compliant Centronics port
PS/2 Port
 Used for old computer keyboard and mouse
 Also called mouse port
 Most of the old computers provide two PS/2 port, each for mouse and
keyboard
 Also known as IEEE 1284-compliant Centronics port
Universal Serial Bus (or USB) Port
 It can connect all kinds of external USB devices such as external hard disk,
printer, scanner, mouse, keyboard etc.
 It was introduced in 1997.
 Most of the computers provide two USB ports as minimum.
 Data travels at 12 megabits per seconds
 USB compliant devices can get power from a USB port
VGA Port
 Connects monitor to a computer's video card.
 Has 15 holes.
 Similar to serial port connector but serial port connector has pins, it has
holes.
Power Connector
 Three-pronged plug
 Connects to the computer's power cable that plugs into a power bar or wall
socket
Firewire Port
 Transfers large amount of data at very fast speed.
 Connects camcorders and video equipments to the computer
 Data travels at 400 to 800 megabits per seconds
 Invented by Apple
 Three variants : 4-Pin FireWire 400 connector, 6-Pin FireWire 400 connector
and 9-Pin FireWire 800 connector
Modem Port
 Connects a PC's modem to the telephone network
Ethernet Port
 Connects to a network and high speed Internet.
 Connect network cable to a computer.
 This port resides on an Ethernet Card.
 Data travels at 10 megabits to 1000 megabits per seconds depending upon
the network bandwidth.
Game Port
 Connect a joystick to a PC
 Now replaced by USB.
Digital Video Interface, DVI port
 Connects Flat panel LCD monitor to the computer's high end video graphic
cards.
 Very popular among video card manufacturers.
Sockets
 Connect microphone, speakers to sound card of the computer

Hardware of computer
Hardware represents the physical and tangible components of a computer i.e. the
components that can be seen and touched.
Examples of Hardware are following:
 Input devices -- keyboard, mouse etc.
 Output devices -- printer, monitor etc.
 Secondary storage devices -- Hard disk, CD, DVD etc.
 Internal components -- CPU, motherboard, RAM etc.

Software of computer
Software is a set of programs, which is designed to perform a well-defined function.
A program is a sequence of instructions written to solve a particular problem.
There are two types of software
 System Software
 Application Software

System Software
The system software is collection of programs designed to operate, control, and
extend the processing capabilities of the computer itself. System software are
generally prepared by computer manufactures. These software products comprise
of programs written in low-level languages which interact with the hardware at a
very basic level. System software serves as the interface between hardware and the
end users.
Some examples of system software are Operating System, Compilers, Interpreter,
Assemblers etc.
Application Software
Application software products are designed to satisfy a particular need of a
particular environment. All software applications prepared in the computer lab can
come under the category of Application software.
Application software may consist of a single program, such as a Microsoft's
notepad for writing and editing simple text. It may also consist of a collection of
programs, often called a software package, which work together to accomplish a
task, such as a spreadsheet package.
Examples of Application software are following:
 Payroll Software
 Student Record Software
 Inventory Management Software
 Income Tax Software
 Railways Reservation Software
 Microsoft Office Suite Software
 Microsoft Word
 Microsoft Excel
 Microsoft Powerpoint

Operating System

It is a program with following features:


 An operating system is a program that acts as an interface between the
software and the computer hardware.
 It is an integrated set of specialised programs that are used to manage
overall resources and operations of the computer.
 It is specialised software that controls and monitors the execution of all other
programs that reside in the computer, including application programs and
other system software.
Objectives of Operating System
 To make a computer system convenient to use in an efficient manner
 To hide the details of the hardware resources from the users
 To provide users a convenient interface to use the computer system
 To act as an intermediary between the hardware and its users and making it
easier for the users to access and use other resources
 To manage the resources of a computer system
 To keep track of who is using which resource, granting resource requests,
according for resource using and mediating conflicting requests from
different programs and users
 To provide efficient and fair sharing of resources among users and programs

Characteristics of Operating System


 Memory Management -- keeps tracks of primary memory i.e. what part of it is
in use by whom, what part is not in use etc. and allocates the memory when
a process or program requests it.
 Processor Management -- allocates the processor(CPU) to a process and
deallocates processor when it is no longer required.
 Device Management -- keeps track of all devices. This is also called I/O
controller that decides which process gets the device, when, and for how
much time.
 File Management -- allocates and de-allocates the resources and decides who
gets the resources.
 Security -- prevents unauthorized access to programs and data by means of
passwords and similar other techniques.
 Job accounting -- keeps track of time and resources used by various jobs
and/or users.
 Control over system performance -- records delays between request for a
service and from the system.
 Interaction with the operators -- The interaction may take place via the
console of the computer in the form of instructions. Operating System
acknowledges the same, does the corresponding action and informs the
operation by a display screen.
 Error-detecting aids -- Production of dumps, traces, error messages and other
debugging and error-detecting methods.
 Coordination between other software and users -- Coordination and
assignment of compilers, interpreters, assemblers and other software to the
various users of the computer systems.

Internet
It is a worldwide system which has the following characteristics:
 Internet is a world-wide / global system of interconnected computer
networks.
 Internet uses the standard Internet Protocol (TCP/IP)
 Every computer in internet is identified by a unique IP address.
 IP Address is a unique set of numbers (such as 110.22.33.114) which
identifies a computer’s location.
 A special computer DNS (Domain Name Server) is used to give name to the
IP Address so that user can locate a computer by a name.
 For example, a DNS server will resolve a
namehttp://www.tutorialspoint.com to a particular IP address to uniquely
identify the computer on which this website is hosted.
 Internet is accessible to every user all over the world.

Intranet
 Intranet is system in which multiple PCs are connected to each other.
 PCs in intranet are not available to the world outside the intranet.
 Usually each company or organization has their own Intranet network and
members/employees of that company can access the computers in their
intranet.
 Each computer in Intranet is also identified by an IP Address which is unique
among the computers in that Intranet.

Number Systems
Human beings use decimal (base 10) number systems for counting and
measurements (probably because we have 10 fingers). Computers use binary (base
2) number system, as they are made from binary digital components (known as
transistors) operating in two states - on and off. In computing, we also
use hexadecimal (base 16) or octal (base 8) number systems, as a compact form for
represent binary numbers.
Decimal (Base 10) Number System
Decimal number system has ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9, called digits. It
uses positional notation. That is, the least-significant digit (right-most digit) is of the
order of 10^0 (units or ones), the second right-most digit is of the order
of 10^1 (tens), the third right-most digit is of the order of 10^2 (hundreds), and so on.
For example,
735 = 7×10^2 + 3×10^1 + 5×10^0

Binary (Base 2) Number System


Binary number system has two symbols: 0 and 1, called bits. It is also a positional
notation, for example,
10110B = 1×2^4 + 0×2^3 + 1×2^2 + 1×2^1 + 0×2^0
We shall denote a binary number with a suffix B. A binary digit is called a bit. Eight
bits is called a byte.

Hexadecimal (Base 16) Number System


Hexadecimal number system uses 16 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E,
and F, called hex digits. It is a positional notation, for example,
A3EH = 10×16^2 + 3×16^1 + 14×16^0
We shall denote a hexadecimal number (in short, hex) with a suffix H. Each
hexadecimal digit is also called a hex digit. Computer uses binary system in their
internal operations, as they are built from binary digital electronic components.
However, writing or reading a long sequence of binary bits is cumbersome and
error-prone. Hexadecimal system is used as a compact form or shorthand for binary
bits. Each hex digit is equivalent to 4 binary bits, i.e., shorthand for 4 bits, as follows:
0H (0000B) (0D) 1H (0001B) (1D) 2H (0010B) (2D) 3H (0011B)
(3D)
4H (0100B) (4D) 5H (0101B) (5D) 6H (0110B) (6D) 7H (0111B)
(7D)
8H (1000B) (8D) 9H (1001B) (9D) AH (1010B) (10D) BH (1011B)
(11D)
CH (1100B) (12D) DH (1101B) (13D) EH (1110B) (14D) FH (1111B)
(15D)
Conversion from Hexadecimal to Binary
Replace each hex digit by the 4 equivalent bits, for examples,
A3C5H = 1010 0011 1100 0101B
102AH = 0001 0000 0010 1010B
Conversion from Binary to Hexadecimal
Starting from the right-most bit (least-significant bit), replace each group of 4 bits by
the equivalent hex digit (pad the left-most bits with zero if necessary), for examples,
1001001010B = 0010 0100 1010B = 24AH
10001011001011B = 0010 0010 1100 1011B = 22CBH
It is important to note that hexadecimal number provides a compact
form or shorthand for representing binary bits.
Conversion from Base r to Decimal (Base 10)
Given a n-digit base r number: dn-1 dn-2 dn-3 ... d3 d2 d1 d0 (base r), the decimal
equivalent is given by:
dn-1 × r^(n-1) + dn-2 × r^(n-2) + ... + d1 × r^1 + d0 × r^0
For examples,
10110B = 1×2^4 + 1×2^2 + 1×2^1 = 22 (base 10)
Conversion from Decimal (Base 10) to Base r
Use repeated division/remainder. For example,
To convert 261D to hexadecimal:
261/16 => quotient=16 remainder=5
16/16 => quotient=1 remainder=0
1/16 => quotient=0 remainder=1 (quotient=0 stop)
Hence, 261D = 105H
General Conversion between 2 Base Systems with Fractional Part
1. Separate the integral and the fractional parts.
2. For the integral part, divide by the target radix repeatably, and collect the
ramainder in reverse order.
3. For the fractional part, multiply the fractional part by the target radix repeatably,
and collect the integral part in the same order.
Example 1:
Convert 18.6875D to binary
Integral Part = 18D
18/2 => quotient=9 remainder=0
9/2 => quotient=4 remainder=1
4/2 => quotient=2 remainder=0
2/2 => quotient=1 remainder=0
1/2 => quotient=0 remainder=1 (quotient=0 stop)
Hence, 18D = 10010B
Fractional Part = .6875D
.6875*2=1.375 => whole number is 1
.375*2=0.75 => whole number is 0
.75*2=1.5 => whole number is 1
.5*2=1.0 => whole number is 1
Hence .6875D = .1011B
Therefore, 18.6875D = 10010.1011B
Example 2:
Convert 18.6875D to hexadecimal
Integral Part = 18D
18/16 => quotient=1 remainder=2
1/16 => quotient=0 remainder=1 (quotient=0 stop)
Hence, 18D = 12H
Fractional Part = .6875D
.6875*16=11.0 => whole number is 11D (BH)
Hence .6875D = .BH
Therefore, 18.6875D = 12.BH

Computer Memory & Data Representation


Computer uses a fixed number of bits to represent a piece of data, which could be a
number, a character, or others. A n-bit storage location can represent up
to 2^n distinct entities. For example, a 3-bit memory location can hold one of these
eight binary patterns: 000, 001, 010, 011, 100, 101, 110, or 111. Hence, it can
represent at most 8 distinct entities. You could use them to represent numbers 0 to
7, numbers 8881 to 8888, characters 'A' to 'H', or up to 8 kinds of fruits like apple,
orange, banana; or up to 8 kinds of animals like lion, tiger, etc.
Integers, for example, can be represented in 8-bit, 16-bit, 32-bit or 64-bit. You, as the
programmer, choose an appropriate bit-length for your integers. Your choice will
impose constraint on the range of integers that can be represented. Besides the
bit-length, an integer can be represented in various representation schemes, e.g.,
unsigned vs. signed integers. An 8-bit unsigned integer has a range of 0 to 255, while
an 8-bit signed integer has a range of -128 to 127 - both representing 256 distinct
numbers.
It is important to note that a computer memory location merely stores a binary
pattern. It is entirely up to you, as the programmer, to decide on how these patterns
are to be interpreted. For example, the 8-bit binary pattern "0100 0001B" can be
interpreted as an unsigned integer 65, or an ASCII character ‘A’. In other words, you
have to first decide how to represent a piece of data in a binary pattern before the
binary patterns make sense. The interpretation of binary pattern is called data
representation or encoding.
3.  Integer Representation
Integers are whole numbers or fixed-point numbers 
Unsigned Integers: can represent zero and positive integers.
Signed Integers: can represent zero, positive and negative integers. Three
representation schemes had been proposed for signed integers:
a. Sign-Magnitude representation
b. 1's Complement representation
c. 2's Complement representation

 n-bit Unsigned Integers


Unsigned integers can represent zero and positive integers, but not negative
integers. The value of an unsigned integer is interpreted as "the magnitude of its
underlying binary pattern".
Example 1: Suppose that n=8 and the binary pattern is 0100 0001B, the value of this
unsigned integer is 1×2^0 + 1×2^6 = 65D.
Example 2: Suppose that n=16 and the binary pattern is 0001 0000 0000 1000B, the
value of this unsigned integer is 1×2^3 + 1×2^12 = 4104D.
Example 3: Suppose that n=16 and the binary pattern is 0000 0000 0000 0000B, the
value of this unsigned integer is 0.
An n-bit pattern can represent 2^n distinct integers. An n-bit unsigned integer can
represent integers from 0 to (2^n)-1, as tabulated below:
n Minimum Maximum
8 0 (2^8)-1  (=255)
16 0 (2^16)-1 (=65,535)
32 0 (2^32)-1 (=4,294,967,295) (9+ digits)
64 0 (2^64)-1 (=18,446,744,073,709,551,615) (19+ digits)

Signed Integers
Signed integers can represent zero, positive integers, as well as negative integers.
Three representation schemes are available for signed integers:
1. Sign-Magnitude representation
2. 1's Complement representation
3. 2's Complement representation

n-bit Sign Integers in Sign-Magnitude Representation


In sign-magnitude representation:
 The most-significant bit (msb) is the sign bit, with value of 0 representing
positive integer and 1 representing negative integer.
 The remaining n-1 bits represents the magnitude (absolute value) of the integer.
The absolute value of the integer is interpreted as "the magnitude of the (n-1)-bit
binary pattern".
Example 1: Suppose that n=8 and the binary representation is 0 100 0001B.
   Sign bit is 0 ⇒ positive
   Absolute value is 100 0001B = 65D
   Hence, the integer is +65D
Example 2: Suppose that n=8 and the binary representation is 1 000 0001B.
   Sign bit is 1 ⇒ negative
   Absolute value is 000 0001B = 1D
   Hence, the integer is -1D
Example 3: Suppose that n=8 and the binary representation is 0 000 0000B.
   Sign bit is 0 ⇒ positive
   Absolute value is 000 0000B = 0D
   Hence, the integer is +0D
Example 4: Suppose that n=8 and the binary representation is 1 000 0000B.
   Sign bit is 1 ⇒ negative
   Absolute value is 000 0000B = 0D
   Hence, the integer is -0D
The drawbacks of sign-magnitude representation are:
1. There are two representations (0000 0000B and 1000 0000B) for the number
zero, which could lead to inefficiency and confusion.
2. Positive and negative integers need to be processed separately.

n-bit Sign Integers in 1's Complement Representation


In 1's complement representation:
 Again, the most significant bit (msb) is the sign bit, with value of 0 representing
positive integers and 1 representing negative integers.
 The remaining n-1 bits represents the magnitude of the integer, as follows:
o for positive integers, the absolute value of the integer is equal to "the
magnitude of the (n-1)-bit binary pattern".
o for negative integers, the absolute value of the integer is equal to "the
magnitude of the complement (inverse) of the (n-1)-bit binary pattern"
(hence called 1's complement).
Example 1: Suppose that n=8 and the binary representation 0 100 0001B.
   Sign bit is 0 ⇒ positive
   Absolute value is 100 0001B = 65D
   Hence, the integer is +65D
Example 2: Suppose that n=8 and the binary representation 1 000 0001B.
   Sign bit is 1 ⇒ negative
   Absolute value is the complement of 000 0001B, i.e., 111 1110B = 126D
   Hence, the integer is -126D
Example 3: Suppose that n=8 and the binary representation 0 000 0000B.
   Sign bit is 0 ⇒ positive
   Absolute value is 000 0000B = 0D
   Hence, the integer is +0D
Example 4: Suppose that n=8 and the binary representation 1 111 1111B.
   Sign bit is 1 ⇒ negative
   Absolute value is the complement of 111 1111B, i.e., 000 0000B = 0D
   Hence, the integer is -0D
Again, the drawbacks are:
1. There are two representations (0000 0000B and 1111 1111B) for zero.
2. The positive integers and negative integers need to be processed separately.

n-bit Sign Integers in 2's Complement Representation


In 2's complement representation:
 Again, the most significant bit (msb) is the sign bit, with value of 0 representing
positive integers and 1 representing negative integers.
 The remaining n-1 bits represents the magnitude of the integer, as follows:
o for positive integers, the absolute value of the integer is equal to "the
magnitude of the (n-1)-bit binary pattern".
o for negative integers, the absolute value of the integer is equal to "the
magnitude of the complement of the (n-1)-bit binary pattern plus one" (hence
called 2's complement).
Example 1: Suppose that n=8 and the binary representation 0 100 0001B.
   Sign bit is 0 ⇒ positive
   Absolute value is 100 0001B = 65D
   Hence, the integer is +65D
Example 2: Suppose that n=8 and the binary representation 1 000 0001B.
   Sign bit is 1 ⇒ negative
   Absolute value is the complement of 000 0001B plus 1, i.e., 111 1110B + 1B = 127D
   Hence, the integer is -127D
Example 3: Suppose that n=8 and the binary representation 0 000 0000B.
   Sign bit is 0 ⇒ positive
   Absolute value is 000 0000B = 0D
   Hence, the integer is +0D
Example 4: Suppose that n=8 and the binary representation 1 111 1111B.
   Sign bit is 1 ⇒ negative
   Absolute value is the complement of 111 1111B plus 1, i.e., 000 0000B + 1B = 1D
   Hence, the integer is -1D

3.8  Decoding 2's Complement Numbers


1. Check the sign bit (denoted as S).
2. If S=0, the number is positive and its absolute value is the binary value of the
remaining n-1 bits.
3. If S=1, the number is negative.
4. .You could "invert the n-1 bits and plus 1" to get the absolute value of negative
number. Alternatively, you could scan the remaining n-1 bits from the right
(least-significant bit). Look for the first occurrence of 1. Flip all the bits to the
left of that first occurrence of 1. The flipped pattern gives the absolute value.
For example,
5. n = 8, bit pattern = 1 100 0100B
6. S = 1 → negative
7. Scanning from the right and flip all the bits to the left of the first occurrence of
1 ⇒ 011 1100B = 60D
Hence, the value is -60D

Floating-Point Number Representation


A floating-point number (or real number) can represent a very large (1.23×10^88) or a
very small (1.23×10^-88) value. It could also represent very large negative number
(-1.23×10^88) and very small negative number (-1.23×10^88), as well as zero, as
illustrated:

A floating-point number is typically expressed in the scientific notation, with


a fraction (F), and an exponent (E) of a certain radix (r), in the form of F×r^E. Decimal
numbers use radix of 10 (F×10^E); while binary numbers use radix of 2 (F×2^E).
Representation of floating point number is not unique. For example, the
number 55.66 can be represented as 5.566×10^1, 0.5566×10^2, 0.05566×10^3, and
so on. The fractional part can be normalized. In the normalized form, there is only a
single non-zero digit before the radix point. For example, decimal
number 123.4567 can be normalized as 1.234567×10^2; binary
number 1010.1011B can be normalized as 1.0101011B×2^3.
It is important to note that floating-point numbers suffer from loss of precision when
represented with a fixed number of bits (e.g., 32-bit or 64-bit). This is because there
are infinite number of real numbers (even within a small range of says 0.0 to 0.1). On
the other hand, a n-bit binary pattern can represent a finite 2^n distinct numbers.
Hence, not all the real numbers can be represented. The nearest approximation will
be used instead, resulted in loss of accuracy.
In computers, floating-point numbers are represented in scientific notation of 
fraction (F) and exponent (E) with a radix of 2, in the form of F×2^E. Both E and F can
be positive as well as negative. Modern computers adopt IEEE 754 standard for
representing floating-point numbers. There are two representation schemes: 32-bit
single-precision and 64-bit double-precision.

IEEE-754 32-bit Single-Precision Floating-Point Numbers


In 32-bit single-precision floating-point representation:
 The most significant bit is the sign bit (S), with 0 for positive numbers and 1 for
negative numbers.
 The following 8 bits represent exponent (E).
 The remaining 23 bits represents fraction (F).

Normalized Form
Let's illustrate with an example, suppose that the 32-bit pattern is 1 1000 0001 011
0000 0000 0000 0000 0000, with:
 S=1
 E = 1000 0001
 F = 011 0000 0000 0000 0000 0000
In the normalized form, the actual fraction is normalized with an implicit leading 1 in
the form of 1.F. In this example, the actual fraction is 1.011 0000 0000 0000 0000
0000 = 1 + 1×2^-2 + 1×2^-3 = 1.375D.
The sign bit represents the sign of the number, with S=0 for positive and S=1 for
negative number. In this example with S=1, this is a negative number, i.e., -1.375D.
In normalized form, the actual exponent is E-127 (so-called excess-127 or bias-127).
This is because we need to represent both positive and negative exponent. With an
8-bit E, ranging from 0 to 255, the excess-127 scheme could provide actual exponent
of -127 to 128. In this example, E-127=129-127=2D.
Hence, the number represented is -1.375×2^2=-5.5D.

De-Normalized Form
Normalized form has a serious problem, with an implicit leading 1 for the fraction, it
cannot represent the number zero! Convince yourself on this!
De-normalized form was devised to represent zero and other numbers.
For E=0, the numbers are in the de-normalized form. An implicit leading 0 (instead of
1) is used for the fraction; and the actual exponent is always -126. Hence, the
number zero can be represented with E=0and F=0 (because 0.0×2^-126=0).
We can also represent very small positive and negative numbers in de-normalized
form with E=0. For example, if S=1, E=0, and F=011 0000 0000 0000 0000 0000. The
actual fraction is0.011=1×2^-2+1×2^-3=0.375D. Since S=1, it is a negative number.
With E=0, the actual exponent is -126. Hence the number is -0.375×2^-126 =
-4.4×10^-39, which is an extremely small negative number (close to zero).

Example 1: Suppose that IEEE-754 32-bit floating-point representation pattern


is 0 10000000 110 0000 0000 0000 0000 0000.
Sign bit S = 0 ⇒ positive number
E = 1000 0000B = 128D (in normalized form)
Fraction is 1.11B (with an implicit leading 1) = 1 + 1×2^-1 + 1×2^-2 = 1.75D
The number is +1.75 × 2^(128-127) = +3.5D
Example 2: Suppose that IEEE-754 32-bit floating-point representation pattern
is 1 01111110 100 0000 0000 0000 0000 0000.
Sign bit S = 1 ⇒ negative number
E = 0111 1110B = 126D (in normalized form)
Fraction is 1.1B (with an implicit leading 1) = 1 + 2^-1 = 1.5D
The number is -1.5 × 2^(126-127) = -0.75D
Example 3: Suppose that IEEE-754 32-bit floating-point representation pattern
is 1 01111110 000 0000 0000 0000 0000 0001.
Sign bit S = 1 ⇒ negative number
E = 0111 1110B = 126D (in normalized form)
Fraction is 1.000 0000 0000 0000 0000 0001B (with an implicit leading 1) = 1 +
2^-23
The number is -(1 + 2^-23) × 2^(126-127) = -0.500000059604644775390625 (may
not be exact in decimal!)
Example 4 (De-Normalized Form): Suppose that IEEE-754 32-bit floating-point
representation pattern is 1 00000000 000 0000 0000 0000 0000 0001.
Sign bit S = 1 ⇒ negative number
E = 0 (in de-normalized form)
Fraction is 0.000 0000 0000 0000 0000 0001B (with an implicit leading 0) = 1×2^-23
The number is -2^-23 × 2^(-126) = -2×(-149)

IEEE-754 64-bit Double-Precision Floating-Point Numbers


The representation scheme for 64-bit double-precision is similar to the 32-bit
single-precision:
 The most significant bit is the sign bit (S), with 0 for positive numbers and 1 for
negative numbers.
 The following 11 bits represent exponent (E).
 The remaining 52 bits represents fraction (F).

The value (N) is calculated as follows:


 Normalized form: For 1 ≤ E ≤ 2046, N = (-1)^S × 1.F × 2^(E-1023).
 Denormalized form: For E = 0, N = (-1)^S × 0.F × 2^(-1022). These are in the
denormalized form.
 For E = 2047, N represents special values, such as ±INF (infinity), NaN (not a
number).
Assembler: A computer will not understand any program written in a language, other
than its machine language. The programs written in other languages must be
translated into the machine language. Such translation is performed with the help of
software. A program which translates an assembly language program into a
machine language program is called an assembler. If an assembler which runs on a
computer and produces the machine codes for the same computer then it is called
self assembler or resident assembler. If an assembler that runs on a computer and
produces the machine codes for other computer then it is called Cross Assembler.
Assemblers are further divided into two types: One Pass Assembler
and Two Pass Assembler. One pass assembler is the assembler which assigns the
memory addresses to the variables and translates the source code into machine
code in the first pass simultaneously. A Two Pass Assembler is the assembler which
reads the source code twice. In the first pass, it reads all the variables and assigns
them memory addresses. In the second pass, it reads the source code and
translates the code into object code.

Compiler: It is a program which translates a high level language program into a


machine language program. A compiler is more intelligent than an assembler. It
checks all kinds of limits, ranges, errors etc. But its program run time is more and
occupies a larger part of the memory. It has slow speed. Because a compiler goes
through the entire program and then translates the entire program into machine
codes. If a compiler runs on a computer and produces the machine codes for the
same computer then it is known as a self compiler or resident compiler. On the other
hand, if a compiler runs on a computer and produces the machine codes for other
computer then it is known as a cross compiler.

Interpreter: An interpreter is a program which translates statements of a program


into machine code. It translates only one statement of the program at a time. It
reads only one statement of program, translates it and executes it. Then it reads the
next statement of the program again translates it and executes it. In this way it
proceeds further till all the statements are translated and executed. On the other
hand, a compiler goes through the entire program and then translates the entire
program into machine codes. A compiler is 5 to 25 times faster than an interpreter.
By the compiler, the machine codes are saved permanently for future
reference. On the other hand, the machine codes produced by interpreter are not
saved. An interpreter is a small program as compared to compiler. It occupies less
memory space, so it can be used in a smaller system which has limited memory
space.

Linker: In high level languages, some built in header files or libraries are stored.
These libraries are predefined and these contain basic functions which are essential
for executing the program. These functions are linked to the libraries by a program
called Linker. If linker does not find a library of a function then it informs to compiler
and then compiler generates an error. The compiler automatically invokes the linker
as the last step in compiling a program.
Not built in libraries, it also links the user defined functions to the user
defined libraries. Usually a longer program is divided into smaller subprograms
called modules. And these modules must be combined to execute the program. The
process of combining the modules is done by the linker.

Type of Programming Languages

Low-Level
Machine code is low level because it runs directly on the processor.  Low-level
languages are appropriate for writing operating systems or firmware for
micro-controllers. 
Characteristics
 Direct memory management
 Little-to-no abstraction from the hardware
 Register access
 Statements usually have an obvious correspondence with clock cycles
 Superb performance
Mid-Level
This is really the level at which virtual machines start to become common-place. 
Java, Scala, C# etc all use a virtual machine to provide an execution environment. 
Thus, many mid-level languages don’t compile directly down to the metal (at least,
not right away) but represent a blurring between interpreted and compiled
languages.  Mid-level languages are almost always defined in terms of low-level
languages (e.g. the Java compiler is bootstrapped from C).
Characteristics
 High level abstractions such as objects (or functionals)
 Static typing
 Extremely commonplace (mid-level languages are by far the most widely
used)
 Virtual machines
 Garbage collection
 Easy to reason about program flow
High-Level
high-level languages are the logical semantic evolution of mid-level languages.  It
makes a lot of sense when you consider the philosophy of simplification and
increase of abstraction.  After all, people were n times more productive switching
from C to Java with all of its abstractions.  If that really was the case, then can’t we
just add more and more layers of abstraction to increase productivity exponentially?
High-level languages tend to be extremely dynamic.  Runtime flow is changed on the
fly through the use of things like dynamic typing, open classes, etc.  This sort of
technique provides a tremendous amount of flexibility in algorithm design.  However,
this sort of mucking about with execution also tends to make the programs harder to
reason about.  It can be very difficult to follow the flow of an algorithm written in
Ruby.  This “obfuscation of flow” is precisely why I don’t think high-level languages
like Ruby are suitable for large applications.
Characteristics
 Interpreted
 Dynamic constructs (open classes, message-style methods, etc)
 Poor performance
 Concise code
 Flexible syntax (good for internal DSLs)
 Hybrid paradigm (object-oriented and functional)
 Fanatic community

Algorithm and Flowchart

ALGORITHM
An algorithm is a step wise set of finite instructions written to solve a
problem.

FLOWCHART
Flowchart is the diagrammatic representation of an algorithm with the help of
symbols carrying certain meaning.
Examples Of Algorithms In Programming
Write an algorithm to add two numbers entered by user.

Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
sum←num1+num2
Step 5: Display sum
Step 6: Stop

Write an algorithm to find the largest among three different numbers entered by
user.

Step 1: Start
Step 2: Declare variables a,b and c.
Step 3: Read variables a,b and c.
Step 4: If a>b
If a>c
Display a is the largest number.
Else
Display c is the largest number.
Else
If b>c
Display b is the largest number.
Else
Display c is the greatest number.
Step 5: Stop

Write an algorithm to find all roots of a quadratic equation ax2+bx+c=0.

Step 1: Start
Step 2: Declare variables a, b, c, D, x1, x2, rp and ip;
Step 3: Calculate discriminant
D←b2-4ac
Step 4: If D≥0
r1←(-b+√D)/2a
r2←(-b-√D)/2a
Display r1 and r2 as roots.
Else
Calculate real part and imaginary part
rp←b/2a
ip←√(-D)/2a
Display rp+j(ip) and rp-j(ip) as roots
Step 5: Stop

Write an algorithm to find the factorial of a number entered by user.

Step 1: Start
Step 2: Declare variables n,factorial and i.
Step 3: Initialize variables
factorial←1
i←1
Step 4: Read value of n
Step 5: Repeat the steps until i=n
5.1: factorial←factorial*i
5.2: i←i+1
Step 6: Display factorial
Step 7: Stop

Write an algorithm to check whether a number entered by user is prime or not.

Step 1: Start
Step 2: Declare variables n,i,flag.
Step 3: Initialize variables
flag←1
i←2
Step 4: Read n from user.
Step 5: Repeat the steps until i<(n/2)
5.1 If remainder of n÷i equals 0
flag←0
Go to step 6
5.2 i←i+1
Step 6: If flag=0
Display n is not prime
else
Display n is prime
Step 7: Stop

Write an algorithm to find the Fibonacci series till term≤1000.

Step 1: Start
Step 2: Declare variables first_term,second_term and temp.
Step 3: Initialize variables first_term←0 second_term←1
Step 4: Display first_term and second_term
Step 5: Repeat the steps until second_term≤1000
5.1: temp←second_term
5.2: second_term←second_term+first term
5.3: first_term←temp
5.4: Display second_term
Step 6: Stop

Algorithm is not the computer code. Algorithm are just the instructions which gives
clear idea to you idea to write the computer code.

Flow Chart

The flowchart is a means of visually presenting the flow of data through an


information processing systems, the operations performed within the system and
the sequence in which they are performed. In this lesson, we shall concern ourselves
with the program flowchart, which describes what operations (and in what
sequence) are required to solve a given problem. The program flowchart can be
likened to the blueprint of a building. As we know a designer draws a blueprint before
starting construction on a building. Similarly, a programmer prefers to draw a
flowchart prior to writing a computer program. As in the case of the drawing of a
blueprint, the flowchart is drawn according to defined rules and using standard
flowchart symbols prescribed by the American National Standard Institute, Inc.

GUIDELINES FOR DRAWING A FLOWCHART


Flowcharts are usually drawn using some standard symbols; however, some special
symbols can also be developed when required. Some standard symbols, which are
frequently required for flowcharting many computer programs are shown in Fig. 25.1
Start or end of the program

Computational steps or processing function of a program

Input or output operation

Decision making and branching

Connector or joining of two parts of program

Magnetic Tape

Magnetic Disk

Off-page connector

    Flow line

Annotation

Display

The following are some guidelines in flowcharting:


(a) In drawing a proper flowchart, all necessary requirements should be listed
out in logical order.
(b) The flowchart should be clear, neat and easy to follow. There should not
be any room for ambiguity in understanding the flowchart.
(c) The usual direction of the flow of a procedure or system is from left to
right or top to bottom.
(d) Only one flow line should come out from a process symbol.

  or

(e) Only one flow line should enter a decision symbol, but two or three flow
lines, one for each possible answer, should leave the decision symbol.

Yes <0 >0

No =0

(f) Only one flow line is used in conjunction with terminal symbol.
(g) Write within standard symbols briefly. As necessary, you can use the
annotation symbol to describe data or computational steps more clearly.

This is top secret data

(h) If the flowchart becomes complex, it is better to use connector symbols to


reduce the number of flow lines. Avoid the intersection of flow lines if you
want to make it more effective and better way of communication.
(i) Ensure that the flowchart has a logical start and finish.
(j) It is useful to test the validity of the flowchart by passing through it with a
simple test data.

ADVANTAGES OF USING FLOWCHARTS


The benefits of flowcharts are as follows:

1. Communication: Flowcharts are better way of communicating the logic of a


system to all concerned.
2. Effective analysis: With the help of flowchart, problem can be analysed in more
effective way.
3. Proper documentation: Program flowcharts serve as a good program
documentation, which is needed for various purposes.
4. Efficient Coding: The flowcharts act as a guide or blueprint during the systems
analysis and program development phase.
5. Proper Debugging: The flowchart helps in debugging process.
6. Efficient Program Maintenance: The maintenance of operating program
becomes easy with the help of flowchart. It helps the programmer to put efforts
more efficiently on that part

LIMITATIONS OF USING FLOWCHARTS

1. Complex logic: Sometimes, the program logic is quite complicated. In that case,
flowchart becomes complex and clumsy.
2. Alterations and Modifications: If alterations are required the flowchart may
require re-drawing completely.
3. Reproduction: As the flowchart symbols cannot be typed, reproduction of
flowchart becomes a problem.
4. The essentials of what is done can easily be lost in the technical details of how it
is done.

Examples of flowcharts in programming


Draw a flowchart to add two numbers entered by user.
Draw flowchart to find the largest among three different numbers entered by user.

Draw a flowchart to find all the roots of a quadratic equation ax2+bx+c=0


Draw a flowchart to find the Fibonacci series till term≤1000.

Program Execution at Micro Level

A computer executes the instructions using repeating machine cycle: fetch, decode,
execute

Fetch: copy the instruction to be executed from memory to IR. The address of that
instruction is stored in the PC which should then be incremented.
Decode: interprets the command in the instruction register as binary code to be
executed.
Execute: sends the order to a component of CPU.

Вам также может понравиться