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

UNIT-I

Introduction to Computer Systems:

Computer:

A computer is a complex system consisting of both hardware and software components. A


computer is an electronic device which can performs arithmetic & logical operations very fastly.

(OR)

Computer is an electronic device which operates under the control of instructions stored in its
own memory and it takes the data from the user, process that data, gives the result and stores the result
for future use.

Every computer mainly consists of three things and those are...


1. Hardware
2. Software
3. User

Here the user interacts with the software, and the software makes the computer hardware parts to work
for the user.
All physical components of the computer are called as computer hardware. A user can see, touch
and feel every hardware of the computer. All hardware components perform any task based on the
instructions given by the computer software.
The computer hardware is the physical part of a computer.
The computer hardware components are as follows...
1. Input Devices - These are the parts through which a user can give the data to the computer.
2. Output Devices - These are the physical components of a computer through which the computer
gives the result to the user.

ALL IS WELL Page 1


UNIT-I

3. Storage Devices - These are the physical components of a computer in which the data can be
stored.
4. Devices Drives - Using drives, user can read and write data on to the strorage devices like CD,
floppy, etc.,
5. Cables - Various cables (Wires) are used to make connections in a computer
6. Other Devices - Other than the above hardware components, a computer also contains
components like Mother board, CPU (Processor), SMPS, Fans, etc.,
Input Devices
Computer input devices are the physical components of the computer which are used to give the
data given by the user to the computer. Using input devices the user can give the data to the computer.

Output Devices
Computer output devices are the physical components of the computer which are used to give the
computer result to the User. Using output devices, the user can see the computer generated result.

ALL IS WELL Page 2


UNIT-I

Storage Devices
Computer storage devices are the physical components of the computer which are used to store
data internally or externally.

Device Drives
Computer Device drives are the physical components of the computer which are used to read and
write data of the storage devices.

ALL IS WELL Page 3


UNIT-I

Computer Cables
In a Computer, various cables are used to make connections among the various hardware
components of the computer.

Other Devices

Other devices of the computer are shown below...

CPU (Processor)

ALL IS WELL Page 4


UNIT-I

SMPS

CPU Fan (Heat Sink)

Mother Board

How does Computer works?

When a user wants to communicate with the computer, the user interacts with an application. The
application interacts with the operating system, and the operating system makes hardware components
to work according to the user given instructions. The hardware components sends the result back to the
operating system, then the operating system forwards the same to the application and the application
shows the result to the user.

ALL IS WELL Page 5


UNIT-I

By using input devices, the user interacts with the application and the application uses output
devices to show the result. All input and output devices work according to the instructions given by the
operating system.
The working process of a computer is shown in the following figure...

A computer is a complex system consisting of both hardware and software components. This chapter
discusses these components.
Chapter Topics:
▪ Hardware and Software
▪ Components of a Computer System
▪ Networks
▪ World-Wide Web
▪ The word hardware is used for physical devices such as TV sets, DVD players and computers.
The word software is used for the information used with such devices: movies, music, novels,
web pages, computer programs, and data.
▪ When talking about computer systems, hardware means the physical parts of the
computer. Software means the programs and data used with the physical computer.
Components of a Computer System
Information is funny stuff. The information for the web page you are looking at is recorded on a hard
disk inside a computer located in New Britain, Connecticut. The information was copied from that
physical device to other physical devices perhaps hundreds of times before it got to your computer where
your web browser is using it to display these words on your monitor. Clearly information is something
different from the devices used to store and transmit it.
A computer system consists of both hardware and information stored on hardware. Information stored
on computer hardware is often called software.
The hardware components of a computer system are the electronic and mechanical parts.

ALL IS WELL Page 6


UNIT-I

The software components of a computer system are the data and the computer programs.
The major hardware components of a computer system are:
▪ Processor
▪ Main memory
▪ Secondary memory
▪ Input devices
▪ Output devices
For typical desktop computers, the processor, main memory, secondary memory, power supply, and
supporting hardware are housed in a metal case. Many of the components are connected to the main
circuit board of the computer, called the motherboard. The power supply supplies power for most of the
components. Various input devices (such as the keyboard) and output devices (such as the monitor) are
attached through connectors at the rear of the case.
Hardware Components

The terms input and output say if data flow into or out of the computer. The picture shows the major
hardware components of a computer system. The arrows show the direction of data flow.
A bus is a group of wires on the main circuit board of the computer. It is a pathway for data flowing
between components. Most devices are connected to the bus through a controller which coordinates the
activities of the device with the bus.
The processor is an electronic device about a one inch square, covered in plastic. Inside the square is an
even smaller square of silicon containing millions of tiny electrical parts. A modern processor may
contain billions of transistors. It does the fundamental computing within the system, and directly or
indirectly controls all the other components.

ALL IS WELL Page 7


UNIT-I

The processor is sometimes called the Central Processing Unit or CPU. A particular computer will
have a particular type of processor, such as a Pentium processor or a SPARC processor.
The processor performs all the fundamental computation of the computer system. Other components
contribute to the computation by doing such things as storing data or moving data into and out of the
processor. But the processor is where the fundamental action takes place.
Memory

A processor chip has relatively little memory. It has only enough memory to hold a few instructions of
a program and the data they process. Complete programs and data sets are held in memory external to
the processor. This memory is of two fundamental types: main memory, and secondary memory.
Main memory is sometimes called volatile because it looses its information when power is removed.
Secondary memory is usually nonvolatile because it retains its information when power is removed.
(However, it needs power when information is stored into memory or retrieved from it.)
Main memory is sometimes called main storage and secondary memory is sometimes called secondary
storage or mass storage.

▪ Main memory:
o closely connected to the processor.
o stored data are quickly and easily changed.
o holds the programs and data that the processor is actively working with.
o interacts with the processor millions of times per second.
o needs constant electric power to keep its information.
▪ Secondary memory:
o connected to main memory through the bus and a controller.
o stored data are easily changed, but changes are slow compared to main memory.
o used for long-term storage of programs and data.
o before data and programs can be used, they must be copied from secondary memory into
main memory.
o does not need electric power to keep its information.

ALL IS WELL Page 8


UNIT-I

Main Memory
Main memory is where programs and data are kept when the processor is actively using them. When
programs and data become active, they are copied from secondary memory into main memory where the
processor can interact with them. A copy remains in secondary memory.
Main memory is intimately connected to the processor, so moving instructions and data into and out of
the processor is very fast.
Main memory is sometimes called RAM. RAM stands for Random Access Memory. "Random" means
that the memory cells can be accessed in any order. However, properly speaking, "RAM" means the type
of silicon chip used to implement main memory.
When people say that a computer has "512 megabytes of RAM" they are talking about how big its main
memory is. One megabyte of memory is enough to hold approximately one million (106) characters of a
word processing document. (There will be more about bytes and megabytes later on in these notes.)
Nothing permanent is kept in main memory. Sometimes data are placed in main memory for just a few
seconds, only as long as they are needed.
Secondary Memory
Secondary memory is where programs and data are kept on a long-term basis. Common secondary
storage devices are the hard disk and optical disks.
▪ The hard disk has enormous storage capacity compared to main memory.
▪ The hard disk is usually contained inside the case of a computer.
▪ The hard disk is used for long-term storage of programs and data.
▪ Data and programs on the hard disk are organized into files.
▪ A file is a collection of data on the disk that has a name.
A hard disk might have a storage capacity of 500 gigabytes (room for about 500 x 109 characters). This
is about 100 times the capacity of main memory. A hard disk is slow compared to main memory. If the
disk were the only type of memory the computer system would slow down to a crawl. The reason for
having two types of storage is this difference in speed and capacity.
Large blocks of data are copied from disk into main memory. The operation is slow, but lots of data is
copied. Then the processor can quickly read and write small sections of that data in main memory. When
it is done, a large block of data is written to disk.

ALL IS WELL Page 9


UNIT-I

Often, while the processor is computing with one block of data in main memory, the next block of data
from disk is read into another section of main memory and made ready for the processor. One of the jobs
of an operating system is to manage main storage and disks this way.

Primary memory Secondary memory

▪ Fast ▪ Slow
▪ Expensive ▪ Cheap
▪ Low capacity ▪ Large capacity
▪ Works directly with the processor ▪ Not connected directly to the processor

Input and Output Devices


Input and output devices allow the computer system to interact with the outside world by moving
data into and out of the system. An input device is used to bring data into the system. Some input devices
are:
▪ Keyboard
▪ Mouse
▪ Microphone
▪ Bar code reader
▪ Graphics tablet
An output device is used to send data out of the system. Some output devices are:
▪ Monitor
▪ Printer
▪ Speaker
A network interface acts as both input and output. Data flows from the network into the computer, and
out of the computer into the network.
I/O
Input/output devices are usually called I/O devices. They are directly connected to an electronic module
attached to the motherboard called a device controller. For example, the speakers of a multimedia
computer system are directly connected to a device controller called an audio card, which in turn is
plugged into a bus on the motherboard.

ALL IS WELL Page 10


UNIT-I

With many recent computers, the functions of a device controller are integerated with the motherboard.
Some motherboards have audio, graphics, and network controllers built in.
Sometimes secondary memory devices like the hard disk are called I/O devices (because they move data
in and out of main memory). What counts as an I/O device depends on context. To a user, an I/O device
is something outside of the computer case. To a programmer, anything outside of the processor and main
memory is an I/O device. To an engineer working on the design of a processor everything outside of the
processor is an I/O device.
Embedded Systems
A computer system that is part of a larger machine and which controls how that machine operates is
an embedded system. Usually the processor constantly runs a single control program which is
permanently kept in ROM (Read Only Memory).
ROM is used to make a section of main memory read-only. Main memory looks the same as before to
the processor, except a section of it permanently contains the program the processor is running. This
section of memory retains its data even when power is off.
A typical embedded system is a cell phone. This is obvious, but there are many less obvious embedded
systems. Your car contains dozens of processors, and even more in its audio system. For instance, each
airbag is controlled by its own computer chip. Digital cameras, DVD players, medical equipment, and
even home appliances contain dedicated processors.
The overwhelming majority of processor chips are used in embedded systems. Less than 1% of processor
chips are used in the familiar desktop computer!
Software
Computer software consists of both programs and data. Programs consist of instructions for the
processor. Data can be any information that a program needs: character data, numerical data, image data,
audio data, and countless other types. The distinction between programs and data is not as clear-cut as
you might think, however.
Fundamental Idea: Both programs and data are saved in computer memory in the same way. The
electronics of computer memory (both main memory and secondary memory) make no distinction
between programs and data.
The insight that both programs and data can be saved using the same electronic methods is an important
concept in computer science. Computer systems use memory for either programs or data, as needed.
Types of Programs

ALL IS WELL Page 11


UNIT-I

There are two categories of programs. Application programs (usually called just "applications") are
programs that people use to get their work done. Computers exist because people want to run these
programs. Systemsprograms keep the hardware and software running together smoothly. The difference
between y"application program" and "system program" is fuzzy. Often it is more a matter of marketing
than of logic.
The most important systems program is the operating system. The operating system is always present
when a computer is running. It coordinates the operation of the other hardware and software components
of the computer system. The operating system is responsible for starting up application programs,
running them, and managing the resources that they need. When an application program is running, the
operating system manages the details of the hardware for it. For example, when you type characters on
the keyboard, the operating system determines which application program they are intended for and does
the work of getting them there.
Some embedded systems do not use an operating system, but run their programs directly on the
processor.
Modern operating systems for desktop computers come with a user interface that enables users to easily
interact with application programs (and with the operating system itself) by using windows, buttons,
menus, icons, the mouse, and the keyboard. Examples of operating systems are Unix, Linux, Android,
Mac OS, and Windows.

Application Programs Systems Programs

▪ Word processors ▪ Operating system


▪ Game programs ▪ Networking system
▪ Spreadsheets ▪ Programming language software
▪ Data base systems ▪ Web site server
▪ Graphics programs ▪ Data backup
▪ Web browsers

Operating Systems
An operating system is a complex program that keeps the hardware and software components of a
computer system coordinated and functioning. It is like the owner of a small shop, who keeps everything
in order by attending to customers, accepting deliveries, stocking the shelves, doing the bookkeeping,

ALL IS WELL Page 12


UNIT-I

and so on. The shopkeeper must promptly attend to tasks as they arise. Without the shopkeeper the shop
could not function.
Most computer systems can potentially run any of several operating systems. For example, most
Pentium-based computers can run either Linux or a Windows operating systems. Usually only one
operating system is installed on a computer system, although some computers have several. In any case,
only one operating system at a time can be in control of the computer system. The computer user makes
a choice when the computer is turned on, and that operating system remains in control until the computer
is turned off.

PROBLEM SOLVING ASPECTS:

Solving Aspect
Problem solving is a creative process. It is an act of defining a problem, determining the cause of
the problem, identifying, prioritizing, and selecting alternatives for a solution and implementing a
solution.
A problem can be solved successfully only after making an effort to understand the problem. To
understand the problem, the following questions help:
_ What do we know about the problem?
_ What is the information that we have to process in order the find the solution?
_ What does the solution look like?
_ What sort of special cases exist?
_ How can we recognize that we have found the solution?
It is important to see if there are any similarities between the current problem and other problems
that have already been solved. We have to be sure that the past experience does not hinder us in
developing new methodology or technique for solving a problem. The important aspect to be considered
in problem-solving is the ability to view a problem from a variety of angles.
There is no universal method for solving a given problem. Different strategies appear to be good
for different problems. Some of the well known strategies are:
_ Divide and Conquer
_ Greedy Method
_ Dynamic Programming
_ Backtracking

ALL IS WELL Page 13


UNIT-I

_ Branch and Bound

Program Development Steps


The various steps involved in Program Development are:
➢ Defining or Analyzing the problem
➢ Design (Algorithm)
➢ Coding
➢ Documenting the program
➢ Compiling and Running the Program
➢ Testing and Debugging
➢ Maintenance
ANALYZING OR DEFINING THE PROBLEM
The problem is defined by doing a preliminary investigation. Defining a problem helps us to
understand the problem clear. It is also known as Program Analysis. Tasks in defining a problem
• Specifying the input requirements
• Specifying the output requirements
• Specifying the processing requirements
Specifying the input requirements
Determine the inputs required and source of the data. The input specification is obtained by
answering the following questions:
• What specific values will be provided as input to the program?
• What format will the values be?
• For each input item, what is the valid range of values that it may assume?
• What restrictions are placed on the use of these values?

Specifying the output requirements


Describe in detail the output that will be produced. The output specification is obtained by
answering the following questions:
• What values will be produced?
• What is the format of these values?

ALL IS WELL Page 14


UNIT-I

• What specific annotation, headings, or titles are required in the report?


• What is the amount of output that will be produced?
Specifying the Processing Requirements
Determine the processing requirements for converting the input data to output. The processing
requirement specification is obtained by answering the following questions:
• What is the method (technique) required in producing the desired output?
• What calculations are needed?
• What are the validation checks that need to be applied to the input data?
Example : Find the factorial of a given number
Input: Positive valued integer number
Output: Factorial of that number
Process: Solution technique which transforms input into output. Factorial of a number can be
calculated by the formula n! = 1*2*3*4….*n
DESIGN
A design is the path from the problem to a solution in code. Program Design is both a product
and a process. The process results in a theoretical framework for describing the effects and consequences
of a program as they are related to its development and implementation.
A well designed program is more likely to be:
• Easier to read and understand later
• Less of bugs and errors
• Easier to extend to add new features
• Easier to program in the first place
Modular Design
Once the problem is defined clearly, several design methodologies can be applied. An important
approach is Top-Down programming design. It is a structured design technique which breaks up the
problem into a set of sub-problems called Modules and creates a hierarchical structure of modules.
While applying top-down design to a given problem, consider the following guidelines:
_ A problem is divided it into smaller logical sub-problems, called Modules
_ Each module should be independent and should have a single task to do
_ Each module can have only one entry point and one exit point, so that the logic flow of
the program is easy to follow

ALL IS WELL Page 15


UNIT-I

_ When the program is executed, it must be able to move from one module to the next in
sequence, until the last module is executed
_ Each module should be of manageable size, in order to make the design and testing
easier
Top-down design has the following advantages:
_ Breaking up the problem into parts helps us to clarify what is to be done
_ At each step of refinement, the new parts become more focussed and, therefore,
easier to design
_ Modules may be reused
_ Breaking the problem into parts allows more than one person to work on the solution
simultaneously
ALGORITHM (DEVELOPING A SOLUTION TECHNIQUE)
An algorithm is a step-by-step description of the solution to a problem. It is defined as an ordered
sequence of well-defined and effective operations which, when carried out for a given set of initial
conditions, produce output, and terminate in a finite time. The term “ordered sequence” specifies, after
the completion of each step in the algorithm, the next step must be unambiguously defined.
An algorithm can be defined as “a complete, unambiguous, finite number of logical steps for
solving a specific problem “
An algorithm must be:
_ Definite
_ Finite
_ Precise and Effective
_Generality
_ Implementation independent ( only for problem not for programming languages)
An algorithm must possess the following properties
1. Finiteness: An algorithm must terminate in a finite number of steps
2. Definiteness: Each step of the algorithm must be precisely and unambiguously stated
3. Effectiveness: Each step must be effective, in the sense that it should be primitive easily convert able
into program statement) can be performed exactly in a finite amount of time.
4. Generality: The algorithm must be complete in itself so that it can be used to solve problems of a
specific type for any input data.

ALL IS WELL Page 16


UNIT-I

5. Input/output: Each algorithm must take zero, one or more quantities as input data produce one or
more output values. An algorithm can be written in English like sentences or in any standard
representation sometimes, algorithm written in English like languages are called Pseudo Code
Developing Algorithms
Algorithm development process is a trial-and-error process. Programmers make initial attempt to
the solution and review it, to test its correctness. The errors identified leads to insertions, deletions, or
modifications to the existing algorithm.
This refining continues until the programmer is satisfied that, the algorithm is essentially correct
and ready to be executed. The more experience we gain in developing an algorithm, the closer our first
attempt will be to a correct solution and the less revision will be required. However, a novice programmer
should not view developing algorithm as a single-step operation.
Examples:
1: Algorithm For Finding Factorial Of A Given Number
Step 1: Start
Step 2: Initialize factorial to be 1, i to be 1
Step 3: Input a number n
Step 4: Check whether the number is 0. If so report factorial is 1 and goto step 9
Step 5: Repeat step 6 through step 7 n times
Step 6: Calculate factorial = factorial * i
Step 7: Increment i by 1
Step 8: Report the calculated factorial value
Step 9: Stop
2. Suppose We Want To Find The Average Of Three Numbers, The Algorithm Is As Follows
Step 1 Read the numbers a, b, c
Step 2 Compute the sum of a, b and c
Step 3 Divide the sum by 3
Step 4 Store the result in variable d
Step 5 Print the value of d
Step 6 End of the program
3 . Write an algorithm to calculate the simple interest using the formula. Simple interest = P*N*
R/100.
Where P is principle Amount, N is the number of years and R is the rate of interest.

ALL IS WELL Page 17


UNIT-I

Step 1: Read the three input quantities’ P, N and R.


Step 2 : Calculate simple interest as Simple interest = P* N* R/100
Step 3: Print simple interest.
Step 4: Stop
4. Area of Triangle: Write an algorithm to find the area of the triangle.
Let b, c be the sides of the triangle ABC and A the included angle between the given sides.
Step 1: Input the given elements of the triangle namely sides b, c and angle between the sides A.
Step 2: Area = (1/2) *b*C* sin A
Step 3: Output the Area
Step 4: Stop.
5. Write an algorithm to find the largest of three numbers X, Y,Z.
Step 1: Read the numbers X,Y,Z.
Step 2: if (X > Y) Big = X else BIG = Y
Step 3 : if (BIG < Z)
Step 4: Big = Z
Step 5: Print the largest number i.e. Big
Step 6: Stop.
6. Write algorithm to find the factorial of a given number N

7. Write an algorithm which will test whether a given integer value is prime or not.

ALL IS WELL Page 18


UNIT-I

FLOWCHART:
A flow chart is a step by step diagrammatic representation of the logic paths to solve a given
problem. Or A flowchart is visual or graphical representation of an algorithm. The flowcharts are
pictorial representation of the methods to b used to solve a given problem and help a great deal to analyze
the problem and plan its solution in a systematic and orderly manner. A flowchart when translated in to
a proper computer language, results in a complete program.
Advantages of Flowcharts
1. The flowchart shows the logic of a problem displayed in pictorial fashion which felicitates easier
checking of an algorithm.
2. The Flowchart is good means of communication to other users. It is also a compact means of recording
an algorithm solution to a problem.
3. The flowchart allows the problem solver to break the problem into parts. These parts can be connected
to make master chart.
4. The flowchart is a permanent record of the solution which can be consulted at a later time. Differences
between Algorithm and Flowchart
ALGORITHM FLOW CHART

ALL IS WELL Page 19


UNIT-I

1. A method of representing the step-by-step 1. Flowchart is diagrammatic representation of


logical procedure for solving a problem an algorithm. It is constructed using different
2. It contains step-by-step English descriptions, types of boxes and symbols.
each step representing a particular operation 2. The flowchart employs a series of blocks and
leading to solution of problem arrows, each of which represents a particular
step in an algorithm
3. These are particularly useful for small 3. These are useful for detailed representations
problems of complicated programs
4. For complex programs, algorithms prove to 4. For complex programs, Flowcharts prove to
be Inadequate be adequate

Symbols used in Flow-Charts


The symbols that we make use while drawing flowcharts as given below are as per conventions
followed by International Standard Organization (ISO).
a. Oval: Rectangle with rounded sides is used to indicate either START/ STOP of the program. ..

b. Input and output indicators: Parallelograms are used to represent input and output operations.
Statements like INPUT, READ and PRINT are represented in these Parallelograms.

c. Process Indicators: - Rectangle is used to indicate any set of processing operation such as for storing
arithmetic operations.

ALL IS WELL Page 20


UNIT-I

d. Decision Makers: The diamond is used for indicating the step of decision making and therefore
known as decision box. Decision boxes are used to test the conditions or ask questions and depending
upon the answers, the appropriate actions are taken by the computer. The decision box symbol is

e. Flow Lines: Flow lines indicate the direction being followed in the flowchart. In a Flowchart, every
line must have an arrow on it to indicate the direction. The arrows may be in any direction

f. On- Page connectors: Circles are used to join the different parts of a flowchart and these circles are
called on-page connectors. The uses of these connectors give a neat shape to the flowcharts. Ina
complicated problems, a flowchart may run in to several pages. The parts of the flowchart on different
pages are to be joined with each other. The parts to be joined are indicated by the circle.

g. Off-page connectors: This connector represents a break in the path of flowchart which is too large to
fit on a single page. It is similar to on-page connector. The connector symbol marks where the algorithm
ends on the first page and where it continues on the second.

1. Draw A Flowchart To Find The Factorial Of Given Positive Integer N.

ALL IS WELL Page 21


UNIT-I

2. Develop A Flowchart To Illustrate How To Make A Land Phone Telephone Call

3. Draw A Flowchart For Adding The Integers From 1 To 100 And To Print The Sum.

ALL IS WELL Page 22


UNIT-I

4. Draw The Flowchart To Find Roots Of Quadratic Equation Ax2+ Bx + C= 0. The Coefficients
A, B, C Are The Input Data

ALL IS WELL Page 23


UNIT-I

5. Draw A Flowchart To Find Out The Biggest Of The Three Unequal Positive Numbers.

PSEUDO CODE
Pseudo code is an informal high-level description of an algorithm that uses the structural

ALL IS WELL Page 24


UNIT-I

conventions of programming languages, but omits language-specific syntax. It is an abstract form of a


program. It consists of English like statements which perform the specific operations. It is defined for an
algorithm. It does not use any graphical representation. In pseudo code, the program is represented in
terms of words and phrases.
Advantages:
• Easy to read
• Easy to understand
• Easy to modify
Example
1: Write A Pseudo Code To Perform The Basic Arithmetic Operations.
Read n1, n2
Sum = n1 + n2
Diff = n1 – n2
Mult = n1 * n2
Quot = n1/n2
Print sum, diff, mult, quot
End.
2: Pseudo Code For Finding Factorial Of A Given Number
Step 1: START
Step 2: DECLARE the variables n, fact, i
Step 2: SET variable fact =1 and i =1
Step 3: READ the number n
Step 4: IF n = 0 then
Step 4.1: PRINT factorial = 1
Step 4.2: GOTO Step 9
Step 5: WHILE the condition i<=n is true, repeat Step 6 through Step 7
Step 6: COMPUTE fact = fact * i
Step 7: INCREMENT i by 1
Step 8: PRINT the factorial value
Step 9: STOP
Coding

ALL IS WELL Page 25


UNIT-I

An algorithm expressed in programming languages is called Program. Writing a program is


called Coding. The logic that has been developed in the algorithm is used to write the program.
Documenting the Program
Documentation explains how the program works and how to use the program. Documentation
can be of great value, not only to those involved in maintaining or modifying a program, but also to the
programmers themselves. Details of particular programs, or particular pieces of programs, are easily
forgotten or confused without suitable documentation.
Documentation comes in two forms:
_ External documentation, which includes things such as reference manuals, algorithm descriptions,
flowcharts, and project workbooks
_ Internal documentation, which is part of the source code itself (essentially, the declarations, statements,
and comments)
Compiling and Executing the Program
Compilation is a process of translating a source program into machine understandable form. The
compiler is system software, which does the translation after examining each instruction for its
correctness. The translation results in the creation of object code. After compilation, Linking is done if
necessary. Linking is the process of putting together all the external references (other program files and
functions) that are required by the program. The program is now ready for execution. During execution,
the executable object code is loaded into the computer’s memory and the program instructions are
executed.
Testing
Testing is the process of executing a program with the deliberate intent of finding errors. Testing
is needed to check whether the expected output matches the actual output. Program should be tested with
all possible input data and control conditions.
Testing is done during every phase of program development. Initially, requirements can be tested
for its correctness. Then, the design (algorithm, flow charts) can be tested for its exactness and efficiency.
Structured walk through is made to verify the design.
Programs are tested with several test criteria and the important ones are given below:
_ Test whether each and every statement in the program is executed at least once (Basic path testing)
_ Test /whether every branch in the program is traversed at least once (control flow)
_ Test whether the input data flows through the program and is converted to an output

ALL IS WELL Page 26


UNIT-I

(data flow)
The probability of discovering errors through testing can be increased by selecting significant
test cases. It is important to design test cases for abnormal input conditions.
The Boundary (or Extreme) Cases
How does the algorithm perform at the extremes of the valid cases?
The Unusual Cases
What happens when the input data violates the normal conditions of the problem or represent
unusual condition?
The Invalid Cases
How does the algorithm react for data which are patently illegal or completely meaningless?
An algorithm should work correctly and produce meaningful results for any data. This is called Fool
proof programming.
CODING
Algorithm must be translated into a set of instructions that a computer can understand. Coding should be
simplicity and clarity. A program written by one, it must be readable and simple to understand. The
elements of coding include:
 Internal documentation
 Construction of statements
 Generality of programs
 I/O formats
Internal Documentation:
Documentation refers to the details that describe a program. Some details may be built in as an integral
part of the program. This is known as internal documentation.
Two important aspects of internal documentation are selection of meaningful variable names and the use
of comments.Selection of meaningful names is crucial for understanding the program.
EXAMPLE:
Area=breadth *length
Is more meaningful than
A=b*l;
Names that are likely to be confused must be avoided. The use of meaningful function named also in
understanding and maintenance of programs.

ALL IS WELL Page 27


UNIT-I

Descriptive comments should be embedded with in the body of source code to describe processing steps.
Guidelines help the use of comments:
• Describe blocks of statements rather than commenting on every line
• Use blank lines or indentation, so that comments are easily readable
• Use appropriate comments, an incorrect comment is worse than no comment at all
Statement Construction
The flow of logic is decided during design,the construction of individual statements is done at coding
stage. Each statement should be simple and direct. While multiple statements per line are allowed,try to
use only one statement per line with necessary indentation.
EXAMPLE:
if(quantity>0){code=0; quantity=rate;}
else{code=1;sales=0;}
reorganized as
if(quantity>0)
{
code=0;
quantity=rate;
}
Else
{
code=1;
sales=0;
}
Gudelines:
• Use one statement per line
• Use proper indentation when selection and looping structures are implemented
• Avoid heavy nesting of loops, preferably not more than three levels
• Use simple conditional tests; if necessary break complicated conditions into simple conditions
• Use parenthesis to clarify logical and arithmetic expressions
• Use spaces wherever possible to improve readability
I/O Formats

ALL IS WELL Page 28


UNIT-I

I/O formats should be simple and acceptable to users. A number of guidelines should be considered
during coding
• Keep formats simple
• Use end of file indicators, rather than the user requiring to specify the number of items
• Label all interactive input requests
• Label all output reports
• Use output messages when the output contains some peculiar results.
Generality of programs:
Care should be taken to minimize the dependence of aprogram on a particular set of data or on a particular
value of a parameter.
EXAMPLE:
For(sum=0,i=1; i<=10; i++)
Sum=sum+i;
This loop addd numbers 1,2,….10 .this can be made more general
Sum=0;
For(i=m;i<=n;i=i+step);
Sum=sum+I;
The initial value m,the final value n, and the increment size step can be specified interactively during
program exection. When m=2,n=100 and step=2,the loop adds all even numbers up to including 100
Debugging
Debugging is a process of correcting the errors. Programs may have logical errors which cannot
be caught during compilation. Debugging is the process of identifying their root causes. One of the ways
to ensure the correctness of the program is by printing out the intermediate results at strategic points of
computation.
Some programmers use the terms “testing” and “debugging” interchangeably, but careful
programmers distinguish between the two activities. Testing means detecting errors. Debugging
means diagnosing and correcting the root causes. On some projects, debugging occupies as much as 50
percent of the total development time. For many programmers, debugging is the hardest part of
programming because of improper documentation.

Maintenance

ALL IS WELL Page 29


UNIT-I

Programs require a continuing process of maintenance and modification to keep pace with
changing requirements and implementation technologies. Maintainability and modifiability are essential
characteristics of every program. Maintainability of the program is achieved by:
_ Modularizing it
_ Providing proper documentation for it
_ Following standards and conventions (naming conventions, using symbolic constants etc)
COMPUTER PROGRAMMING ENVIRONMENTS:

Program Development Environments


The environment under which a program is designed, coded, tested & debugged is called Host
Environment. The external environment which supports the execution of a program is termed as
Operating or Target Environment. Host and Target environment may be different for a program or
application.
Programming Environments (Host Environment)
It is the environment in which programs are created and tested. It tends to have less influence on
language design than the operating environment in which programs are expected to be executed. The
production of programs that operate reliably and efficiently is made much simpler by a good
programming environment and by a language that allows the use of good programming tools and
practices.
Target Environments
Target environments can be classified into 3 categories – Batch Processing Environment,
Interactive Environment, and Embedded System Environment. Each poses different requirement
on languages adapted for those environments.
Batch-Processing Environments
In batch-processing environments, the input data are collected in ‘batches’ on files and are
processed in batches by the program. For example, the backup process on an organization. The
transaction details of all the departments are collected for backup at one place and the backup is done at
a time at the end of the day.
Interactive Environments
In interactive environment, a program interacts directly with a user at a display console, by
alternately sending output to the display & receiving input from the keyboard or mouse. Examples
include database management systems, word processing systems etc.

ALL IS WELL Page 30


UNIT-I

Embedded System Environments


An embedded computer system is used to control part of a larger system such as an industrial
plant (computerized machineries) or an aircraft. The computer system will be an integral part of the
larger system, failure of which would imply failure of the larger system as well.
Computing Environments
What is Computing Environment?
When we want to solve a problem using computer, the computer makes use of various devices
which work together to solve that problem. There may be various number of ways to solve a problem.
We use various number of computer devices arranged in different ways to solve different problems. The
arrangement of computer devices to solve a problem is said to be computing environment. The formal
definition of computing environment is as follows...
Computing Environment is a collection of computers which are used to process and exchange the
information to solve various types of computing problems.
Types of Computing Environments
The following are the various types of computing environtments...
1. Personal Computing Environment
2. Time Sharing Computing Environment
3. Client Server Computing Environment
4. Distributed Computing Environment
5. Grid Computing Environment
6. Cluster Computing Environment
Personal Computing Environment
Personal computing is a stand alone machine. In personal computing environment, the complete
program resides on stand alone machine and executed from the same machine. Laptops, mobile devices,
printers, scanners and the computer systems we use at home, office are the examples for personal
computing environment.
Time Sharing Computing Environment
Time sharing computing environment is stand alone computer in which a single user can perform
multiple operations at a time by using multitasking operating system. Here the processor time is divided
among different tasks and this is called “Time sharing”. For example, a user can listen to music while

ALL IS WELL Page 31


UNIT-I

writing something in a text editor. Windows 95 and later versions of windows OS, iOS and Linux
operating systems are the examples for this computing environment.
Client Server Computing Environment
The client server environment contains two machines (Client machine and Server machine).
These both machines will exchange the information through an application. Here Client is a normal
computer like PC, Tablet, Mobile, etc., and Server is a powerful computer which stores huge data and
manages huge amount of file and emails, etc., In this environment, client requests for data and server
provides data to the client. In the client server environment, the communication between client and server
is performed using HTTP (Hyper Text Transfer Protocol).
Distributed Computing Environment
In the distributed computing environment, the complete functionality of a software is not on
single computer but is distributed among multiple computers. Here we use a method of computer
processing in which different programs of an application run simultaneously on two or more computers.
These computers communicate with each other over a network to perform the complete task. In
distributed computing environment, the data is distributed among different systems and that data is
logically related to each other.
Grid Computing Environment
Grid computing is a collection of computers from different locations. All these computers work
for a common problem. A grid can be described as distributed collection of large number of computers
working for a single application.
Cluster Computing Environment
Cluster computing is a collection of inter connected computers. These computers work together
to solve a single problem. In cluster computing environment, a collection of systems work together as a
single system.
Computer Languages
What is Computer Language?
Generally, we use languages like english, hindi, telugu etc., to make communication between two
persons. That means, when we want to make communication between two persons we need a language
through which persons can express their feelings. Similarly, when we want to make communication
between user and computer or between two or more computers we need a language through which user

ALL IS WELL Page 32


UNIT-I

can give information to computer and vice versa. When user wants to give any instruction to the computer
the user needs a specific language and that language is known as computer language.
User interacts with the computer using programs and that programs are created using computer
programming languages like C, C++, Java etc.,
Computer languages are the languages through which user can communicate with the computer
by writing program instructions.
Every computer programming language contains a set of predefined words and a set of rules
(syntax) that are used to create instructions of a program.
Computer Languages Classification
Over the years, computer languages have been evolved from Low Level to High Level
Languages. In the earliest days of computers, only Binary Language was used to write programs. The
computer languages are classified as follows...

Low Level Language (Machine Language)


Low Level language is the only language which can be understood by the computer. Binary
Language is an example of low level language. Low level language is also known as Machine Language.
The binary language contains only two symbols 1 & 0. All the instructions of binary language are written
in the form of binary numbers 1's & 0's. A computer can directly understand the binary language.
Machine language is also known as Machine Code.
As the CPU directly understands the binary language instructions, it does not requires any
translater. CPU directly starts executing the binary language instructions, and takes very less time to

ALL IS WELL Page 33


UNIT-I

execute the instructions as it does not requires any translation. Low level language is considered as the
First Generation Language (1GL).
Advantages
• A computer can easily understand the low level language.
• Low level language instructions are executed directly without any translation.
• Low level language instructions require very less time for thier execution.
Disadvantages
• Low level language instructions are very difficult to use and understand.
• Low level language instructions are machine dependent, that means a program written for a
particular machine does not executes on other machine.
• In low level language, there is more chance for errors and it is very difficult to find errors, debug
and modify.

Middle Level Language (Assembly Language)


Middle level language is a computer language in which the instructions are created using symbols
such as letters, digits and special characters. Assembly language is an example of middle level language.
In assembly language, we use predefined words called mnemonics. Binary code instructions in low level
language are replaced with mnemonics and operands in middle level language. But computer can not
understand mnemonics, so we use a translator called Assembler to translate mnemonics into binary
language. Assembler is a translator which takes assembly code as input and produces machine code as
output. That means, computer can not understand middle level language, so it needs to be translated into
low level language to make it understandable by the computer. Assembler is used to translate middle
level language to low level language.
Advantages
• Writing instructions in middle level language is easier than writing instructions in low level
language.
• Middle level language is more readable compared to low level language.
• Easy to understand, find errors and modify.
Disadvantages
• Middle level language is specific to a particular machine architecture, that means it is machine
dependent.

ALL IS WELL Page 34


UNIT-I

• Middle level language needs to be translated into low level language.


• Middle level language executes slower compared to low level language.
High Level Language
High level language is a computer language which can be understood by the users. High level
language is very similar to the human languages and have a set of grammar rules that are used to make
instructions more easily. Every high level language have a set of predefined words known as Keywords
and a set of rules known as Syntax to create instructions. High level language is more easier to understand
for the users but the computer can not understand it. High level language needs to be converted into low
level language to make it understandable by the computer. We use Compiler or interpretor to convert
high level language to low level language.
Languages like COBOL, FORTRAN, BASIC, C ,C++, JAVA etc., are the examples of high level
languages. All these programming languages use human understandable language like english to write
program instructions. These instructions are converted to low level language by the compiler so that it
can be understood by the computer.
Advantages
• Writing instructions in high level language is more easier.
• High level language is more readable and understandable.
• The programs created using high level language runs on different machines with little change or
no change.
• Easy to understand, create programs, find errors and modify.

Disadvantages
• High level language needs to be translated to low level language.
• High level language executes slower compared to middle and low level languages.

ALL IS WELL Page 35


UNIT-I

Procedure (Steps Involved in Problem Solving)


A computer cannot solve a problem on its own. One has to provide step by step solutions of the problem
to the computer. In fact, the task of problem solving is not that of the computer. It is the programmer
who has to write down the solution to the problem in terms of simple operations hich the computer can
understand and execute. In order to solve a problem by the computer, one has to pass though certain
stages or steps.
A Framework for Problem Solving
The following four phases can be identified in the process of solving problems:
(1) Understanding the problem (see below)
(2) Making a plan of solution (see below)
(3) Carrying out the plan
(4) Looking back i.e. verifying
Each of the first two phases is going to be explained below a little more in detail. Phases (3) and (4)
should be self explanatory.
1. Understanding the Problem
Needless to say that if you do not understand the problem you can never solve it. It is also often true that
if you really understand the problem, you can see a solution.
Below are some of the things that can help us understand a problem.
(1) Extract the principal parts of the problem.
The principal parts are:

ALL IS WELL Page 36


UNIT-I

For "find" type problems, such as "find the principal and return for a given investment", UNKNOWNS,
DATA
and CONDITIONS, and
for "proof" type problems HYPOTHESIS and CONCLUSION.
For examples that illustrate these, see Example 1, and Example 3, respectively.
Be careful about hidden assumptions, data and conditions.
(2) Consult definitions for unfamiliar (often even familiar) terminologies.
(3) Construct one or two simple example to illustrate what the problem says.
EXAMP
Example 1
This is an example in which you can find a solution once you analyze and understand the unknowns and
data.
Problem: A survey of TV viewers shows the following results:
To the question "Do you watch comedies ?", 352 answered "Yes".,
To the question "Do you watch sports ?", 277 answered "Yes", and
To the question "Do you watch both comedies and sports ?", 129 answered "Yes".
Given these data, find, among people who watch at least one of comedies and sports, percentages of
people who watch at least one of comedies and sports watch only comedies, only sports, and both
comedies and sports.
Understanding the Problem: This is a "find" type problem. So we try to identify unknowns, data and
conditions.
The unknowns are the percentage of people who watch only comedies, the percentage of people who
watch
only sports, and the percentage of people who watch both comedies and sports.
The data are the three numbers: 352, 277 and 129, representing the number of people who watch
comedies,
sports, and both comedies and sports, respectively. Note that 352 includes people who watch both
comedies and
sports as well as people who watch only comedies. Similarly for 277.
The conditions are not explicitly given in the problem statement. But one can see that the percentages
must add

ALL IS WELL Page 37


UNIT-I

up to 100, and they must be nonnegative.


Devising a Solution Plan: Here we first examine the principal parts in detail.
First let us consider the unknowns in more detail. To calculate the percentage of the people who watch
only comedies, for example, we need the number of people who watch at least one of comedies and
sports, and the number of people who watch only comedies. Thus actually two unknowns are involved
in each of the required percentages, and the real unknowns are the number of people in each of the
categories, and the number of people who watch at least one of comedies and sports. Next let us look at
the data. First the number 352 is the number of people who watch comedies. But that is not necessarily
that of the people who watch only comedies. It includes that and the number of people who watch both
comedies and sports. Similarly for the second number 277. Let us use symbols to represent each of the
unknowns: Let C represent the number of people who watch only comedies, S that of the people who
watch only sports, and T that of the people who watch at least one of those programs.
Then we have the following relationships among the unknowns:
C + 129 = 352
S + 129 = 277
C + S + 129 = T
From these equations we can easily obtain C = 223, S = 148, and T = 500 .
Thus the required percentages are 44.6%, 29.6%, and 25.8%, respectively.
All we had to do to solve this problem is to analyze relationships between the data and the unknowns,
that is, nothing much beyond "understanding the problem".
2. Devising a Solution Plan
Where to start ?
Start with the consideration of the principal parts: unknowns, data, and conditions for "find" problems,
and hypothesis, and conclusion for "prove" problems.
To see examples that illustrate these click here.
What can I do ?
Once you identify the principal parts and understand them, the next thing you can do is to consider the
problem from various angles and seek contacts with previously acquired knowledge. The first thing you
should do is to
try to find facts that are related to the problem at hand. Relevant facts usually involve words that are the
same as

ALL IS WELL Page 38


UNIT-I

or similar to those in the given problem. It is also a good idea to try to recall previously solved similar
problems.
See "Some helpful tips" below for more.
To see examples that illustrate these click here.
What should I look for ?
Look for a helpful idea that shows you the way to the end. Even an incomplete idea should be considered.
Go along with it to a new situation, and repeat this process. Some helpful tips
There is no single method that works for all problems. However, there is a wealth of heuristics we can
try.
Following are some of the often used heuristics.
Add your own heuristics as you gain experience.
(1) Have I seen it before ?
That is, do I know similar or related problems ? Similar/related problems are ones with the same or a
similar unknown or unknown may be different but the settings are the same or similar. See Example 2
for example.
(2) Do a little analysis on relationships among data, conditions and unknowns, or between hypothesis
and conclusion.
(3) What facts do I know related to the problem on hand ?
These are facts on the subjects appearing in the problem. They often involve the same or similar words.
An example can be found below.
It is very important that we know inference rules.
(4) Definitions: Make sure that you know the meaning of technical terms. This is obviously crucial to
problem solving at any level. But especially at this level, if you know their meaning and understand the
concepts, you can see a solution to most of the problems without much difficulty. See for example
Example 1, and Example 2 below.
(5) Compose a wish list of intermediate goals and try to reach them.
(6) Have you used all the conditions/hypotheses ? : When you are looking for paths to a solution or trying
to verify your solution, it is often a good idea to check whether or not you have used all the
data/hypotheses. If you haven't, something is often amiss. See Example 4 for example.
(7) Divide into cases: Sometimes if you divide your problem into a number of separate cases based on a
property of objects appearing in the problem, it simplifies the problem and clear your mind. For example

ALL IS WELL Page 39


UNIT-I

if the problem concerns integers, then you may want to divide it into two cases: one for even numbers
and the other for odd numbers as, for example, you can see in Example 3 below.
(8) Proof by contradiction: If you make an assumption, and that assumption produces a statement that
does not make sense, then you must conclude that your assumption is wrong. For example, suppose that
your car does not start. A number of things could be wrong. Let us assume for simplicity's sake that
either the battery is dead or the starter is defective. So you first assume that the battery is dead and try to
jump start it. If it doesn't start, you have a situation that does not make sense under your assumption of
dead battery. That is, a good battery should start the car but it doesn't. So you conclude that your
assumption is wrong. That is the battery is not the cause.
Proof by contradiction follows that logic.
In this method we first assume that the assertion to be proven is not true and try to draw a contradiction
i.e. something that is always false. If we produce a contradiction, then our assumption is wrong and
therefore the assertion we are trying to prove is true. Example 3 below uses this method When you are
stuck trying to justify some assertion, proof by contradiction is always a good thing to try. (9)
Transform/Restate the problem, then try (1) ( 3) above.
(10) Working backward: In this approach, we start from what is required, such as conclusion or final
(desired) form of an equation etc., and assume what is sought has been found. Then we ask from what
antecedent the desired result could be derived. If the antecedent is found, then we ask from what
antecedent that antecedent could be obtained. ... We repeat this process until either the data/hypotheses
are reached or some easy to solve problem is reached. Example 4 and Example 5 below give simple
examples of this approach.
(11) Simplify the problem if possible. Take advantage of symmetries which often exist.
Example 2
This is a problem which you can solve using similar known results. Problem: Find the (length of)
diagonal of a rectangular parallelepiped given its length, width and height. Again let us try to solve this
problem following the framework presented above.
Understanding the Problem: This is a "find" type problem. So we try to identify unknowns, data and
conditions. The unknown is the diagonal of a rectangular parallelepiped, and the data are its length, width
and height. Again there are no explicitly stated conditions. But the unknown and data must all be a
positive number. Before proceeding to the next phase, let us make sure that we understand the

ALL IS WELL Page 40


UNIT-I

terminologies. First a rectangular parallelepiped is a box with rectangular faces like a cube except that
the faces are not necessarily a square but a rectangle as shown below.

Next a diagonal of a rectangular parallelepiped is the line that connects its two vertices (corner points)
that are not on the same plane. It is shown in the figure below.

Devising a Solution Plan: Here we first try to find relevant facts. Relevant facts often involve the same
or similar words or concepts. Since the unknown is a diagonal, we look for facts concerning diagonal.
Note that drawing figures here is quite helpful.
One of the facts that immediately comes to our mind in this problem is Pythagoras' theorem. It has to do
with right triangles and is shown below.

Let us try to see whether or not this theorem helps. To use this theorem, we need a right triangle involving
a diagonal of a parallelepiped. As we can see below, there is a right triangle with a diagonal x as its
hypotenuse.

ALL IS WELL Page 41


UNIT-I

However, the triangle here involves two unknowns: x and y. Since x is what we are looking for, we need
to find the value of y. To find y, we note another right triangle shown below.

Applying Pythagoras' theorem again, we can obtain the value of y.


Thus y2 = a2 + b2
is obtained from the second triangle, and
x2 = c2 + y2
is derived from the first triangle.
From these two equations, we can find that x is equal to the positive square root of a2 + b2 + c2 .
Example 3
This is a proof type problem and "proof by contradiction" is used.
Problem: Given that a, b, and c are odd integers, prove that equation ax2 + bx + c = 0 can not have a
rational root.
Understanding the Problem: This is a "prove" type problem. The hypothesis is that a, b, and c are odd
integers, and the conclusion is that equation ax2 + bx + c = 0 can not have a rational root.
The hypothesis is straightforward. In the conclusion, "rational root" means a root, that is, the value of x
that satisfies the equation, and that can be expressed as m/n, where m and n are integers. So the conclusion
means that there is no number of the form m/n that satisfies the equation under the hypothesis.
Devising a Solution Plan: For this problem, let us try "proof by contradiction". When you are asked to
prove the impossibility of an event or nonexistence of certain things, this approach often is quite helpful.
Following the "proof by contradiction", let us assume that the conclusion is false, that is the equation

ALL IS WELL Page 42


UNIT-I

ax2 + bx + c = 0 has a rational root m/n, where m and n are integers, when a, b, and c are odd integers.
We can assume without loss of generality that m and n do not have any factors in common. Then a(m/n)2
+ b(m/n) + c = 0 .
( 1) Let us try to derive a contradiction from this. First let us make this equation simpler, that is, let us
get rid of fractions. Since n is not equal to 0, multiplying the both sides of (1) by n2, we get
am2 + bmn + cn2 = 0 .
(2) Since m is an integer, it is either even or odd. We are going to consider those cases one by one. That
is "divide into cases".
Let us first consider the case when m is even.
Then n is odd, since otherwise m and n have a common factor 2. Now am2 + bmn is even, and cn2 is
odd. Hence am2 + bmn + cn2 can not be 0.
Next let us consider the case when m is odd.
By an argument similar to the previous case, we can see that n is also odd.
If m and n are odd, then am2, bmn, and cn2 are all odd, since a, b, and c are odd integers. However, the
sum of three odd numbers can not be equal to 0.
Thus by assuming that the conclusion is false, we have arrived at a contradiction, that is m/n does not
satisfy the equation. Hence our assumption must be wrong, and therefore the conclusion is correct.
Example 4
This is another proof type problem and "working backward" technique is used.
Problem: Prove that ( a + b + c )2 4( ab + bc + ca ) , if a, b, c are three sides of a triangle.
Understanding the Problem: This is a "prove" type problem. The hypothesis is that a, b, and c are three
sides of a triangle, and the conclusion is that inequality ( a + b + c )2 4( ab + bc + ca ) holds.
Devising a Solution Plan: Here we try "Working Backward" heuristic. That is manipulate the conclusion
possibly using the hypothesis and reduce it into something that is obviously true.
First by multiplying out the left hand side of the inequality, ( a + b + c )2 = a2 + b2 + c2 + 2( ab + bc +
ca ) . Hence if a2 + b2 + c2 2( ab + bc + ca ) , then the conclusion holds. Next, to see what we can try,
note that we have not used the hypothesis yet, and see if it can help here. It is well known that the sum
of two sides of a triangle is greater than the third side. Hence a + b > c , b + c > a , and c + a > b hold.
From these we can obtain c(a + b) > c2 , a(b + c) > a2 , and b(c + a) > b2 . By adding these three
inequalities, we get a2 + b2 + c2 < a(b + c) + b(c + a) + c(a + b) = 2( ab + bc + ca ) . Hence a2 + b2 +

ALL IS WELL Page 43


UNIT-I

c2 < 2( ab + bc + ca ) . Hence a2 + b2 + c2 2( ab + bc + ca ) . Hence ( a + b + c )2 4( ab + bc + ca )


holds.

Generation of computers

Introduction to computers A computer is an electronic device capable of manipulating numbers and


symbols under the control of a set of instructions known as computer program. They are different stages
of computers (generation)
1.First Generation Computers
1. Vacuum tubes were used which produce more heat

2. Speed of computing was measured in milliseconds

3. Limited storage capacity

4. punched cards were used for I/O operation

2. Second – Generation Computers


1. Transistors and diodes were used.

2. Speed of computing was measured in microseconds

3. Consider about reduction of heat

4. Remarkable improvement in reliability

5. Storage capacity was increased

6. Magnetic tapes were used instead of punching cards.


3. Third Generation Computers
1. Integrated Circuits were used.

2. Speed is measured in nanoseconds

3. Occupied less space.

4. devices like visual display unit for I/O devices


4. Fourth – Generation Computers

ALL IS WELL Page 44


UNIT-I

1. Use of micro processor chip

2. Speed was measured in nano and picoseconds


3. Occupied less space

4. Commonly available as personal computers

5. Mini & micro Computers are developed from micro-processor


5. Fifth – Generation Computers:
1. Use of super large-scale integration (SLSI) chip in computer (super computers)

2. Capable of performing millions of instructions per seconds (MIPS)

3. Processing speed is high.

4. Use of RICS (reduced instructions set computing) for processing

5. Super computers are expensive.

TYPES OF COMPUTER
The computer sitting on the desk in your classroom is a microcomputer. It is a small, powerful
piece of equipment. Even so, the power of the microcomputer is not enough for most large organizations.
The computer industry consists of more than just microcomputers.
Any classification of computers is somewhat arbitrary. Computer can be classified it to following basis
defined below.
· On the basis of functionality
· On the basis of Size, Speed and Cost.
ON THE BASIS OF FUNCTIONALITY:
According to functionality computer can be divided in to three types:
1. Analog
2. Digital
3. Hybrid
ANALOG COMPUTERS:
DEFINITION:

ALL IS WELL Page 45


UNIT-I

·“An analog (spelled analogue in British English) computer is a form of computer that uses
the continuously-changeable aspects of physical fact such as electrical, mechanical, or hydraulic
quantities to model the problem being solved.”
· Analog means continuity of associated quantity just like an analog clock measures time by means of the
distance traveled by the hand of the clock around a dial.

EXAMPLES: Thermometer Analog clock Speedometer Tire pressure gauge


ADVANTAGES:
· Analog computer has come to refer to- devices and media that represent - Store images -Sound,
motion pictures, etc.
DISADVANTAGES:
· Analog computers can have a very wide range of complexity.
· Slide rules and monographs are the simplest, while naval gun fire control computers and large hybrid
digital/analogue computers were among the most complicated.
· Very complicated for containing output for the users some time.

DIGITAL COMPUTERS:
DEFINITION:
· “A computer that performs calculations and logical operations with quantities represented as digits,
usually in the binary number system of “0” and “1”.
· “Computer capable of solving problems by processing information expressed in discrete form. By
manipulating combinations of binary digits (“0”, “1”), it can perform mathematical calculations,
organize and analyze data, control industrial and other processes, and simulate dynamic systems such as
global weather patterns. ”

ALL IS WELL Page 46


UNIT-I

EXAMPLES: · IBM PC · Apple Macintosh ·Calculators ·Digital watches etc


HYBRID COMPUTERS:
DEFINITION:
· “A computer that processes both analog and digital data”.
· “Hybrid computer is a digital computer that accepts analog signals, converts them to digital and
processes them in digital form”
A hybrid computer may use or produce analog data or digital data. It accepts a continuously
varying input, which is then converted into a set of discrete values for digital processing.
Examples:
· Hybrid computer is the computer used in hospitals to measure the heartbeat of the patient.
· Devices used in petrol pump.
· Hybrid Machines are generally used in scientific applications or in controlling industrial
processes.

ON THE BASIS OF SIZE, SPEED AND COST:


We can divide computers on the basis of size cost and speed as:
· Super Computer
· Mainframe Computer
· Mini Computer
- Micro Computer
· Personal Computer
o Desktop computers

ALL IS WELL Page 47


UNIT-I

o Laptop /Note Books


· Mobile Computer & Devices
o PDA
o Tablet PC
o Hand Held Computer
o Laptop/Note Books

SUPER COMPUTER
Supercomputers are the largest, fastest, most powerful, and most expensive computers made.
Like other large systems, supercomputers can be accessed by many individuals at the same time.
Supercomputers are used primarily for scientific applications that are mathematically intensive. The first
supercomputer was built in the 1960s for the United States Department of Defense.
This computer was designed to be the world's fastest and most powerful computer of that time.
The commitment to create the fastest, most powerful computer in the world is still the driving force
behind the development of supercomputers. Manufacturers produce relatively few of any one model of
supercomputer, and they spend millions of dollars on research and development of new
machines.

Supercomputers derive much of their speed from the use of multiple


processors. Multiprocessing enables the computers to perform tasks simultaneously--either assigning
different tasks to each processing unit or dividing a complex task among several processing units.

EXAMPLE: · Cray-1 ·Cray-2 ·Control Data Cyber 205 ·ETA

Note: The speed of modern supercomputers is measured in nanoseconds and gigaflop. A nanosecond is
one billionth of a second. A gigaflop is one billion floating-point arithmetic operations per second.

MAINFRAME COMPUTER

ALL IS WELL Page 48


UNIT-I

Mainframe computers are the most powerful computers. A mainframe computer may contain several
microprocessors. A single mainframe computer can be used by hundreds of people at once. Each user
has his own terminal that is connected to the mainframe. Mainframe computers are usually kept in a
special cooled, clean computer room. Minicomputers are medium-sized computers which are more
powerful than microcomputers but not as powerful as mainframes.
A mainframe computer system is usually composed of several computers in addition to the mainframe,
or host processor.
Host Processor:
The host processor is responsible for controlling the other processors, all the peripheral devices, and the
mathematics operations.

Front End processor:

A front-end processor is responsible for handling communications to and from all the remote terminals
connected to the computer system.

Back end Processor:


Sometimes a back-end processor is used to handle data retrieval operations. Although the host
computer could perform all these operations, it can be used more efficiently if relieved of time-
consuming chores that do not require processing speed.

FEATURES:
· Mainframe computer systems are powerful enough to support several hundred users
simultaneously at remote terminals.

· Mainframe Computers are so much faster than people, the users never notice that the computer
is handling other tasks.

· This capability to process many programs concurrently for multiple users is known
asmultiprogramming.

· The typical mainframe computer occupies much of a large room.

ALL IS WELL Page 49


UNIT-I

· Like supercomputers, mainframes require an environment with closely monitored humidity


and temperature.

· Mainframe computers are priced between $100,000 and $2,000,000.

EXAMPLE:- IBM S/390 - Amdahl 580 - Control Data Cyber 176

MINI COMPUTER

The "age of the mini" started in the late 1960s. The creation of integrated circuits suitable for
computers enabled designers to shrink the size of the computer. Minicomputers are frequently referred
to as mid-rangecomputers.

Before Digital Equipment Corporation (DEC) released the first DEC PDP-8 minicomputer in 1968,
most medium-sized organizations were priced out of the computer market because they couldn't afford
mainframe computers.
EXAMPLE:
· IBM AS/400 ·IBM SYSTEM 360 ·HP 3000 ·PRIME 9755
MICROCOMPUTER
When you are working on a multiuser computer, such as a mainframe or minicomputer, you can
control the input and see the output on the display, but you control nothing else.
A single-user computer gives you control over all the phases of computer processing: input,
processing, output, and storage. You can select the programs you want to use, and you don't have to
compete with other users to gain access to the system. A single-user system is designed to meet the
computing needs of an individual.
Single-user computers fall into two categories:
· Workstations

ALL IS WELL Page 50


UNIT-I

· Microcomputers.
WORKSTATION:
A workstation is a powerful desktop computer designed to meet the computing needs
of engineers, architects, and other professionals who need detailed graphics displays. The workstation
has sometimes been called a "super micro." The workstation looks very much like a desktop
microcomputer, but the chips inside make the difference
For example, workstations are commonly used for computer-aided design (CAD), in which
industrial designers create pictures of technical parts or assemblies. To process these complex and
detailed diagrams, the computer needs great processing power and much storage.
MICROCOMPUTERS:
It is difficult to overstate the impact of the microcomputer on the computer industry. In 1975, the
microcomputer did not exist. In 1995, sales exceeded $116 billion. Microcomputers are the fastest
growing segment of the computer industry.
The microcomputer segment of the industry is complex; there are different types of
microcomputer platforms with varying capabilities. The most common type of microcomputer is
a desktop computer, which is a non portable personal computer that fits on top of a desk. (will describe
below).
Microcomputers are the smallest and cheapest of these and are used at home, in schools and in
some businesses. Mainframe computers are the most powerful computers

This table makes some comparisons between the different types of computer:

Comparison Microcomputer Minicomputer Mainframe

ALL IS WELL Page 51


UNIT-I

Medium sized
Home, small
business. e.g. Large
business, on a
Where Used supermarket, businesses,
network in
traffic control universities.
a largerbusiness.
system.

Number of
1 1 – 20 Hundreds
Users

30,000 – 200,000 25,000-100,00 Rs


Cost
Rs Rs 2,000,000+

PERSONAL COMPUTER
DEFINITION:
“A small computer, intended for use by an individual. A personal computer will usually fit on a
desk.” A computer designed for use by a single user. Although other Microcomputers preceded it, the
IBM PC was the first to use the name specifically. As a result, the term PC now applies to an IBM-
compatible computer as contrasted to the Apple Macintosh, these being the two standards that emerged
from an abundance of competitors in the early 1980s.

PC further divided in to two types:

· DesktopComputer

· Laptop/ Note book Computer

DESKTOP COMPUTER:
DEFINITION:
“A computer designed for desktop use; usually comprises, at a minimum, a central processing unit
(CPU), a monitor, and a keyboard as separate units, connected by special cables. Most such computers
now also include a Pointing Device.

ALL IS WELL Page 52


UNIT-I

A computer that could fit on a desk was considered remarkably small. Desktop computers come in a
variety of types ranging from large vertical tower cases to small form factor models that can be tucked
behind an LCD monitor.
"Desktop" can also indicate a horizontally-oriented computer case usually intended to have the display
screen placed on top to save space on the desktop. Most modern desktop computers have separate screens
and keyboards.

LAPTOP /NOTE BOOK COMPUTER:


DEFINITION:

· “A laptop is a personal computer designed for mobile use, small and light enough to sit on a
person's lap while in use.”

· “A portable computer typically weighing less than 6 pounds (3 kilograms) that has a flat-panel
display and miniature hard disk drives, and is powered by rechargeable batteries.”

Laptops are capable of many of the same tasks that desktop computers perform, although they are
typically less powerful. Laptops contain components that are similar to those in their desktop
counterparts and perform the same functions but are miniaturized and optimized for mobile use and
efficient power consumption. Laptops usually have LCD displays.

Laptops generally cost around twice as much as a desktop machine of similar specification. Performance
is always lower than that of a comparable desktop because of the compromises necessary to keep weight
and power consumption low.

MOBILE COMPUTERS / DEVICES

ALL IS WELL Page 53


UNIT-I

All devices which can carry in hand and portable, is said to be mobile
devices and computers.

These Devices are categorized in:

· PDA · Tablet PC · Hand Held Computer · Laptop/Note Books PDA

DEFINITION:

PDA stands for “Personal Digital Assistant”. A small, handheld system combining in one device
multiple computing, Internet, networking, and fax/telephone features”A PDA contain following features:

· Keep phone directories

· Calendars and provide calculator capabilities

· Schedule appointments

· Retrieve frequently used phone numbers

· Jot down notes.

· Most PDAs are designed to accept written input by a pen; the PDA decodes what you write.

ALL IS WELL Page 54


UNIT-I

TABLETPC
DEFINITION:

· “A tablet PC is a wireless personal computer (PC) that allows a user to take notes using natural
handwriting with a stylus or digital pen on a touch screen.”

A tablet PC is similar in size and thickness to a yellow paper notepad and is intended to function as the
user's primary personal computer as well as a note-taking device.

Tablet PCs generally have two formats, a convertible model with an integrated keyboard and display
that rotates 180 degrees and can be folded down over the keyboard or a slate style, with a removable
keyboard.

The user's handwritten notes, which can be edited and revised, can also be indexed and searched or
shared via e-mail or cell phone.

HAND HELD COMPUTER


DEFINITION

ALL IS WELL Page 55


UNIT-I

· “Very small, lightweight device (such as the Palm Pilot) which provides functionality approaching
that of a laptop computer. “
Features of modern handhelds include calendar and diary organizing, word processing, data
management, remote access to firm's network, internet access, wireless access, messaging, etc

LAPTOP/NOTE BOOKS COMPUTER


DEFINITION:

· “A laptop is a personal computer designed for mobile use, small and light enough to sit on a
person's lap while in use.”

“A portable computer typically weighing less than 6 pounds (3 kilograms) that has a flat-panel
display and miniature hard disk drives, and is powered by rechargeable batteries.”

Laptops are capable of many of the same tasks that desktop computers perform, although they are
typically less powerful. Laptops contain components that are similar to those in their desktop
counterparts and perform the same functions but are miniaturized and optimized for mobile use and
efficient power consumption. Laptops usually have LCD displays.

Laptops generally cost around twice as much as a desktop machine of similar specification. Performance
is always lower than that of a comparable desktop because of the compromises necessary to keep weight
and power consumption low.

ALL IS WELL Page 56


UNIT-I

ALL IS WELL Page 57

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