Pps Unit 1 Notes Aktu
Pps Unit 1 Notes Aktu
A computer is basically a programmable computing machine. Computers which are in used today are
digital computers. They manipulate numbers. They operate on binary digits 0 and 1. They understand
information composed of only 0s and 1s. in the case of alphabetic information, the alphabets are
coded in binary digits. A binary digit is called bit. A group of 8 bits is called a byte. Computers do not
operate on analog quantities directly. If any analog quantity is to be processed, it must be converted
into digital quantity before processing. The output of a computer is also digital.
The computers are playing a great role in various application of human life. So, it is necessary to know
about the functioning of computer system. The function of computer system is very much similar to
working of any real word object. This functioning can be easily understood by following operations.
INPUT Operation: The computer first receives input from outside world. The input for computer is the
data, in the form of characters, words, statements. We give the input for computer and then the actual
work is done to produce desired result. For this purpose, there are special devices provided with
computer systems, known as input devices.
PROCESS Operation: When the data is received by computer, it is first stored in the memory of
computer. The storage of data is necessary, so that, we can use the data in future when required. This
stored data is further send for processing, i.e., analysis. The processing means actual operation on data
after analysing it. The processing device is responsible for the processing operations.
OUTPUT Operation: After processing the data, the final result needs to be produced. The result is
produced by the output device. The production of output by computer system is called output operation.
All computer systems perform in the same way and include all these operation. These all operations
are to be performed in a sequence.
Data Processing
The activity of processing data using a computer is called
is raw material used as input and is processed data obtained as output of data
processing.
Characteristics of Computers:
1) Automatic: Given a job, computer can work on it automatically without human interventions.
2) Speed: Computer can perform data processing jobs very fast, usually measured in
microseconds (10-6), nanoseconds (10-9), and picoseconds (10-12).
3) Storage Capability: The computers have the ability to store a huge amount of data in its
secondary devices like floppy and hard disk. The stored information also can retrieve
immediately. The storage capacity of computer is expressed in Bytes. Normally one byte stores
one character of data.
0, 1 1 Bit
4 Bits 1 Nibble
8 Bits (2 Nibble) 1 Byte
1 Byte 1 Character
1024 Byte 1 KB (Kilo Byte)
1024 KB 1 MB (Mega Byte)
1024 MB 1 GB (Giga Byte)
1024 GB 1 TB (Tera Byte)
4) Accuracy: Accuracy of a computer is consistently high and the degree of its accuracy depends
upon its design. Computer errors caused due to incorrect input data or unreliable programs are
often referred to as (GIGO).
5) Diligence: Computer is free from monotony, tiredness, and lack of concentration. It can
continuously work for hours without creating any error and without grumbling.
6) Versatility: Computer is capable of performing almost any task, if the task can be reduced to a
finite series of logical steps.
7) Power of Remembering: Computer can store and recall any amount of information because of
its secondary storage capability. It forgets or looses certain information only when it is asked to
do so.
8) No I.Q.: A computer does only what it is programmed to do. It cannot take its own in
this regard.
9) No Feelings: Computers are devoid of emotions. Their judgment is based on the instructions
given to them in the form of programs that are written by us (human beings).
Classification of Computers
We know that computer is an electronic device to perform mathematical and logical calculations. The
history of computers tells us that “ Charles Babbage” is called the “ Father of Computers” . Now in
this chapter we are trying to describe the types of computers and elaborate classification of computers.
Computers can be classified in various ways depending upon its size, memory capacity, processing
speed etc. Here we are going to discuss the broadly accepted classification of computer. The criteria of
this classification are as discussed above. Computers are classified into four categories:
1. Mainframe Computers
2. Mini Computers
3. Micro Computers
4. Super Computers
1. Mainframe Computers: Mainframe computers are very large, often filling an entire room. They can
store enormous of information, can perform many tasks at the same time, can communicate with many
users at the same time, and are very expensive. . The price of a mainframe computer frequently runs
into the millions of dollars. Mainframe computers usually have many terminals connected to them.
These terminals look like small computers but they are only devices used to send and receive
information from the actual computer using wires. Terminals can be located in the same room with
the mainframe computer, but they can also be in different rooms, buildings, or cities. Large businesses,
government agencies, and universities usually use this type of computer.
2. Mini Computers: Minicomputers are much smaller than mainframe computers and they are also
much less expensive. The cost of these computers can vary from a few thousand dollars to several
hundred thousand dollars. They possess most of the features found on mainframe computers, but on a
more limited scale. They can still have many terminals, but not as many as the mainframes. They can
store a tremendous amount of information, but again usually not as much as the mainframe. Medium
and small businesses typically use these computers.
3. Micro Computers: Microcomputers are the types of computers we are using in your classes at Floyd
College. These computers are usually divided into desktop models and laptop models. They are
terribly limited in what they can do when compared to the larger models discussed above because they
can only be used by one person at a time, they are much slower than the larger computers, and they can
not store nearly as much information, but they are excellent when used in small businesses, homes, and
school classrooms. These computers are inexpensive and easy to use. They have become an
indispensable part of modern life.
4. Super Computers: The biggest in size, the most expensive in price than any other is classified and
known as super computer. It can process trillions of instructions in seconds. Governments specially
use this type of computer for their different calculations and heavy jobs. Different industries also use
this huge computer for designing their products. In most of the Hollywood's movies it is used for
animation purposes. This kind of computer is also helpful for forecasting weather reports worldwide.
5. Notebook computers: Having a small size and low weight the notebook is easy to carry to anywhere.
A student can take it with him/her to his/her school in his/her bag with his/her book. This is easy to
carry around and preferred by students and business people to meet their assignments and other
necessary tasks. The approach of this computer is also the same as the Personal computer. It can
store the same amount of data and having a memory of the same size as that of a personal computer.
Hardware: Hardware, in the computer world, refers to the physical components that make up a
computer system. There are many, many different kinds of hardware that can be installed inside and
connected to the outside of a computer. However, there are several standard pieces of hardware that
can be found as part of nearly every computer:
Types of memory: Computers use several different types of memory. They are:
1. Main Memory / Primary Memory units: Two most important are: RAM (Random Access Memory)
and ROM (Read-only Memory)
RAM or Random Access Memory is the central storage unit in a computer system. It is the place in a
computer where the operating system, application programs and the data in current use are kept
temporarily so that they can be accessed by the computer’ s processor. The more RAM a computer
has, the more data a computer can manipulate.
Random access memory, also called the Read/Write memory, is the temporary memory of a computer.
It is said to be ‘ volatile’ since its contents are accessible only as long as the computer is on. The
contents of RAM are cleared once the computer is turned off.
ROM or Read Only Memory is a special type of memory which can only be read and contents of which
are not lost even when the computer is switched off. It typically contains manufacturer’ s instructions.
Among other things, ROM also stores an initial program called the ‘ bootstrap loader’ whose function
is to start the computer software operating, once the power is turned on.
3. CPU Registers: Accumulator is a register which holds one of the operands prior to the execution of
an instruction and receives results of the most arithmetic and logical operations. General purpose
register store data and intermediate results during the execution of a program.
4. Cache Memory: The word cache is pronounced as cash. The cache memory is placed in between
CPU and main memory. Its access time is about 10 ns which is much less than of the main memory.
Software: Software is a general term for the various kinds of programs used to operate computers and
related devices. Software is classified as follows:
System Software: System software refers to the operating system and all utility programs that manage
computer resources at a low level. Operating system controls and manages the computing resources.
Examples of operating system: Windows, Unix, MSDOS, Linux, Mac.
1. Program Execution: OS provides an environment where the user can conveniently run programs.
The user does not have to worry about memory allocation or CPU scheduling.
2. I/O Operations: Each program requires input and produces output. The OS hides some of the
details of the underlying hardware for such I/O. All the user sees is that the I/O has been
performed, without those details.
3. Communications: There are instances where processes need to communicate with each other
to exchange information. It may be between processes running on the same computer or
running on different computers. The OS provides these services to application programs, making
inter-process communication possible, and relieving the user of having to worry about how this
accomplished.
(1) Batch operating system: The users of batch operating system do not interact with the computer
directly. Each user prepares his job on an off-line device like punch cards and submits it to the
computer operator. To speed up processing, jobs with similar needs are batched together and run as a
group. Thus, the programmers left their programs with the operator. The operator then sorts programs
into batches with similar requirements.
The problems with Batch Systems are following.
Lack of interaction between the user and job.
CPU is often idle, because the speeds of the mechanical I/O devices are slower than CPU.
Difficult to provide the desired priority.
(2) Time-sharing operating systems: Time sharing is a technique which enables many people, located
at various terminals, to use a particular computer system at the same time. Time-sharing or
multitasking is a logical extension of multiprogramming. Processor's time which is shared among
multiple users simultaneously is termed as time-sharing. The main difference between Multi
programmed Batch Systems and Time-Sharing Systems is that in case of multi programmed batch
systems, objective is to maximize processor use, whereas in Time-Sharing Systems objective is to
minimize response time. Multiple jobs are executed by the CPU by switching between them, but the
switches occur so frequently. Thus, the user can receive an immediate response. For example, in a
transaction processing, processor execute each user program in a short burst or quantum of
computation. That is if n users are present, each user can get time quantum. When the user submits the
command, the response time is in few seconds at most. Operating system uses CPU scheduling and
multiprogramming to provide each user with a small portion of a time. Computer systems that were
designed primarily as batch systems have been modified to time-sharing systems.
Advantages of Timesharing operating systems are following
Provide advantage of quick response.
Avoids duplication of software.
Reduces CPU idle time.
Disadvantages of Timesharing operating systems are following.
Problem of reliability.
Question of security and integrity of user programs and data.
Problem of data communication.
(3) Distributed operating System: Distributed systems use multiple central processors to serve multiple
real time application and multiple users. Data processing jobs are distributed among the processors
accordingly to which one can perform each job most efficiently. The processors communicate with one
another through various communication lines (such as high-speed buses or telephone lines). These are
referred as loosely coupled systems or distributed systems. Processors in a distributed system may
vary in size and function. These processors are referred as sites, nodes, and computers and so on.
The advantages of distributed systems are following.
With resource sharing facility user at one site may be able to use the resources available at
another.
Speedup the exchange of data with one another via electronic mail.
If one site fails in a distributed system, the remaining sites can potentially continue operating.
Better service to the customers.
Reduction of the load on the host computer.
Reduction of delays in data processing.
(4) Network operating System: Network Operating System runs on a server and and provides server the
capability to manage data, users, groups, security, applications, and other networking functions. The
primary purpose of the network operating system is to allow shared file and printer access among
multiple computers in a network, typically a local area network (LAN), a private network or to other
networks. Examples of network operating systems are Microsoft Windows Server 2003, Microsoft
Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD.
The advantages of network operating systems are following.
Centralized servers are highly stable.
Security is server managed.
Upgrades to new technologies and hardware can be easily integrated into the system.
Remote access to servers is possible from different locations and types of systems.
Algorithm: Algorithm is defined as the step by step sequence of programming instructions written in
simple user language (English, French, German etc.). These instructions are designed in such a manner
that the program of such sequence on execution will produce the accurate result.
Some rules are to be followed for writing an appropriate algorithm.
Example 1:
Consider the case of finding sum of 1 to 10 numbers.
Step 1. Start
Step 2. Initialize sum to zero and num to one.
Sum=0
Num =1
Step 3. Add Num to Sum
Step 4. Add 1 to Num
Step 5. If Num< 10 then goto Step 3
Step 6. Print Sum
Step 7. Stop
Example 2:
Develop an Algorithm chart to evaluate to n!
Step 1. Start
Step 2. Input the number
Step 5. Set I = I + 1
Step 7. I<N, Then go to step 5, otherwise printout the factorial of the number.
Flowchart: The flow chart is a graphical representation of sequence of instructions in a program. The
flow chart uses boxes of different shapes to represent different types of instructions. These boxes are
connected by arrows lines to indicate the flow of data. A flow chart is assumed to be the plan to be
followed during the program writing. It saves the programmer to make errors in programming code. The
flow chart is helpful for testing the program before computing it.
Symbols of Flow Chart: The following symbols are required to indicate various types of instructions in
flowcharts. These symbols have been standardizing by American National Standard Institute (ANSI).
SHAPE DENOTES
Terminal Box
Input/Output Box
ProcessingBox
Decision Box
Condition
Flow Lines
Iteration or LoopingBox
Start End
2. Processing Box: A processing symbol is used in a flow chart to represent arithmetic and data movement
instructions. Thus, all arithmetic processes such as addition, subtraction, multiplication and division are show by
a processing box symbol. The logical process of moving data (assignment operation) from one location of the
main memory to another is also represented by this symbol. When more then one arithmetic and data movement
instructions are to be shown consecutively one after the other, they can be placed in the same processing box
and assumed to be executed in the order of their presence in the box.
A= B + C
3. Decision Box: The decision box is a diamond shaped box to indicate a point at which a decision has
to be made. Then the branching to two or more alternative points is possible. Decision symbol can be
used in following different ways-
If
I = 10
4. Connector: If a flow chart becomes very long, the flow lines start criss-crossing at many places. It
may cause confusion and reduce the clarity of the flow chart. There may be some instances when a
flowchart becomes impossible to be created on single page. Whenever a flowchart becomes too
complex that the number and direction of flow lines become confusing or it spreads over more than
one page, It is useful to make the connector symbol as a substitute for flow lines. These symbols
represent an Entry from or an Exit to another part of the flow chart.
A A
7. Print Box: Print box is use for print the result output.
Print sum
EXAMPLE: Draw the flow chart for the following problem: A departmental store pays its salesman 5%
commission on sales of Rs. 100/- or less, and 8% commission on sales of more than Rs. 100/- Input the
amount of sale and calculate salesman commission.
Start
Input X
X<1 C= X * 5 / 100
C= X * 8 / 100
Print X, C
Example 2: Exchange the value of two variables..
Start
Input A B
Temp = A
A= B
B = Temp
Print A B
Stop
Pseudocode: is a simple way of writing programming code in English. Pseudocode is not actual
programming language. It uses short phrases to write code for programs before you actually create it in
a specific language. Once you know what the program is about and how it will function, then you can
use pseudocode to create statements to achieve the required results for your program.
Understanding Pseudocode:
Pseudocode makes creating programs easier. Programs can be complex and long; preparation is the
key. For years, flowcharts were used to map out programs before writing one line of code in a language.
However, they were difficult to modify and with the advancement of programming languages, it was
difficult to display all parts of a program with a flowchart. It is challenging to find a mistake without
understanding the complete flow of a program. That is where pseudocode becomes more appealing.
To use pseudocode, all you do is write what you want your program to say in English. Pseudocode
allows you to translate your statements into any language because there are no special commands and
it is not standardized. Writing out programs before you code can enable you to better organize and see
where you may have left out needed parts in your programs. All you have to do is write it out in your own
words in short statements. Let's look at some examples.
Examples of Pseudocode:
Example 1: create a program to add 2 numbers together and then display the result.
1. Machine Language: A computer understands information composed of only 0s and 1s and hence it
uses binary digits for its program. The computer’ s instructions are coded and stored in the memory in
the form of 0s and 1s. A program written in the form of 0s and 1s is called machine language program.
There is a specific binary code for each instruction. For example, to add the contents of register A of
register B, the binary code is 10000000 for Intel 8085. The binary code (machine code or object code)
for a certain operation differs from computer to computer. Each microprocessor has its own instruction
set and corresponding machine code.
2. Assembly Language: The written of program in machine language is very difficult, tiresome and
boring job for programmer. Moreover, it is error prone. To solve this problem and to facilitate
programmer easily understandable language have been developed. Assembly language is one of them.
Program can easily be written in alphanumeric symbols instead of 0s and 1s. Meaningful and easily
remember able symbols are selected for this purpose. For example, ADD for addition, SUB for
subtraction, CMP for comparison, etc. Such symbols are known as mnemonics. A program written in
mnemonics is called assembly language programs. The writing of programs in assembly language is
easier and faster as compared to the writing in a machine language.
Advantages of Assembly Language: The advantage of assembly language over high level language is
that computation time of an assembly language program is less. An assembly language program runs
faster to produce the desired results.
3. Low level language: A language in which each statement is directly translated into a single machine
code is known as low-level language. Examples of low level language are machine language and the
assembly language of various processors. The basic problem of an assembly language is that it is
more closely related to the structure of a computer then to the performance of the task which is to be
performed. The programmer spends more time in manipulating registers and considering instruction
sequence than solving actual problems. The programmer must have very detailed knowledge of the
instruction set, architecture and connection of peripherals to the ports etc.
4. High Level Language: To overcome the difficulties associated with assembly languages high-level or
procedure oriented languages have been developed. High level languages permit programmers to
describe tasks in a form which is problem oriented or object oriented rather than computer oriented.
One can formulate problems more efficient in a high level language and need not have a precise
knowledge of the architecture of the computer he is using. The instructions written in high level
language are called statement. Examples of high level language are BASIC, PASCAL, FORTRAN, COBOL,
ALGOL, C, C++, PROLOG, LISP, JAVA etc.
Translators: When program is written in a language other than the machine language of computer, the
computer will not understand it. Hence, the programs written in other languages must be translated into
the machine language of the computer before they are executed. Such translation is performed with the
aid of software. There are three types of translators:
2. Compiler: A program which translates a high level language program into a machine language
program called a compiler. A compiler is more intelligent than an assembler. It checks all kinds
of limits, range, errors etc. But its program execution time is more and occupies a large part of
the memory. It has low speed and low efficiency of memory utilization.
Documentation Section
Link Section
Definition Section
Global Declaration Section
main()
{
Declaration Section
Executable part
}
Subprogram section
Function 1
Function 2
.
.
function n
- The Documentation Section consists of a set of comment lines giving the name of the program and
other details.
-The Link Section provides instructions to the compiler to link functions from the system library. C
program depends upon some header files for function definition that are used in the program. Each
header file has extension ‘ .h’ . The header files are included at the beginning of the program in the C
language. These files should be included using #include directive as given below
Example:
#include<stdio.h>(This will find header file in standard directory)
or
#include” stdio.h” ( This will find header file in Current and Standard directory)
-main() function: Every C program must have one main() function section. int main(void): This is the
function definition for main().Parenthesis followed to main is to tell the user again that main() is a
function. Int main(void) function return an integer.
void main(): This function returns nothing and takes no arguments. The program contains statements
that are enclosed within the braces. The opening braces “ {“ and closing braces “ }” .
In these two braces main() function contains two parts,
declaration and executable part. It is user defined function. The Opening braces sometimes called
logical start and Closing braces known as logical end of the program.
-Declaration Part declares all the variables used in the executable part. There should be at least one
statement in the executable part which contains instructions to perform certain task. The declaration
and executable part must appear between the opening and closing braces. All statements in the
declaration part should end with the semicolon.
-The Subprogram Section contains all the user defined functions that are called in the main function.
EXAMPLE PROGRAM: