PPS Unit 1 First Half Notes
PPS Unit 1 First Half Notes
Unit 1
Introduction to Computers
Computer
A computer is an electronic device, operating under the control of
instructions stored in its own memory that can accept data (input),
process the data according to specified rules, produce information
(output), and store the information for future use.
Functionalities of a computer:
Any digital computer carries out five functions in gross terms:
Computer Components
Any kind of computers consists of HARDWARE AND SOFTWARE.
Hardware:
Computer hardware is the collection of physical elements that constitutes
a computer system. Computer hardware refers to the physical parts or
components of a computer such as the monitor, mouse, keyboard,
computer data storage, hard drive disk (HDD), system unit (graphic cards,
sound cards, memory, motherboard and chips), etc. all of which are
physical objects that can be touched.
Input Devices
Input device is any peripheral (piece of computer hardware equipment to
provide data and control signals to an information processing system such
as a computer or other information appliance.
Input device Translate data from form that humans understand to one that
the computer can work with. Most common are keyboard and mouse
Central Processing Unit (CPU)
A CPU is brain of a computer. It is responsible for all functions and
processes. Regarding computing power, the CPU is the most important
element of a computer system.
The CPU is comprised of three main parts :
* Arithmetic Logic Unit (ALU): Executes all arithmetic and logical
operations. Arithmetic calculations like as addition, subtraction,
multiplication and division. Logical operation like compare numbers,
letters, or special characters.
* Control Unit (CU): controls and co-ordinates computer components.
1. Read the code for the next instruction to be executed.
2. Increment the program counter so it points to the next instruction.
3. Read whatever data the instruction requires from cells in memory.
4. Provide the necessary data to an ALU or register.
5. If the instruction requires an ALU or specialized hardware to complete,
instruct the hardware to perform the requested operation.
* Registers :Stores the data that is to be executed next, "very fast storage
area".
Primary Memory:-
1. RAM: Random Access Memory (RAM) is a memory scheme within
the computer system responsible for storing data on a temporary basis, so
that it can be promptly accessed by the processor as and when needed. It
is volatile in nature, which means that data will be erased once supply to
the storage device is turned off. RAM stores data randomly and the
processor accesses these data randomly from the RAM storage. RAM is
considered "random access" because you can access any memory
cell directly if you know the row and column that intersect at that cell.
2. ROM (Read Only Memory): ROM is a permanent form of storage.
ROM stays active regardless of whether power supply to it is turned on or
off. ROM devices do not allow data stored on them to be modified.
Secondary Memory:-
Stores data and programs permanently :its retained after the power is
turned off
1. Hard drive (HD): A hard disk is part of a unit, often called a "disk drive," "hard
drive," or "hard disk drive," that store and provides relatively quick access to
large amounts of data on an electromagnetically charged surface or set of
surfaces.
2. Optical Disk: an optical disc drive (ODD) is a disk drive that uses laser light
as part of the process of reading or writing data to or from optical discs. Some
drives can only read from discs, but recent drives are commonly both readers
and recorders, also called burners or writers. Compact discs, DVDs, and
Blu-ray discs are common types of optical media which can be read and
recorded by such drives. Optical drive is the generic name; drives are usually
described as "CD" "DVD", or "Bluray", followed by "drive", "writer", etc. There
are three main types of optical media: CD, DVD, and Blu-ray disc. CDs can
store up to 700 megabytes (MB) of data and DVDs can store up to 8.4 GB of
data. Blu-ray discs, which are the newest type of optical media, can store up to
50 GB of data. This storage capacity is a clear advantage over the floppy disk
storage media (a magnetic media), which only has a capacity of 1.44 MB.
3. Flash Disk
A storage module made of flash memory chips. A Flash disks have no
mechanical platters or access arms, but the term "disk" is used because the
data are accessed as if they were on a hard drive. The disk storage structure is
emulated.
Output devices
An output device is any piece of computer hardware equipment used to
communicate the results of data processing carried out by an information
processing system (such as a computer) which converts the electronically
generated information into human readable form.
Software
Software is a generic term for organized collections of computer data and
instructions, often broken into two major categories: system software that
provides the basic non task-specific functions of the computer, and
application software which is used by users to accomplish specific tasks.
Software Types
A. System software is responsible for controlling, integrating, and
managing the individual hardware components of a computer system so
that other software and the users of the system see it as a functional unit
without having to be concerned with the low-level details such as
transferring data from memory to disk, or rendering text onto a display.
Generally, system software consists of an operating system and some
fundamental utilities such as disk for matters, file managers,display
managers, text editors, user authentication (login) and management tools,
and networking and device control software.
B. Application software is used to accomplish specific tasks other than
just running the computer system. Application software may consist of a
single program, such as an image viewer; a small collection of programs
(often called a software package) that work closely together to
accomplish a task, such as a spreadsheet or text processing system; a
larger collection (often called a software suite) of related but independent
programs and packages that have a common user interface or shared data
format, such as Microsoft Office, which consists of closely integrated
word processor, spreadsheet, database, etc.; or a software system, such as
a database management system, which is a collection of fundamental
programs that may provide some service to a variety of other independent
applications.
Unit of Measurements
Storage measurements: The basic unit used in computer data storage is
called a bit (binary digit). Computers use these little bits, which are
composed of ones and zeros, to do things and talk to other computers. All
your files, for instance, are kept in the computer as binary files and
translated into words and pictures by the software (which is also ones and
zeros). This two number system, is called a “binary number system” since
it has only two numbers in it. The decimal number system in contrast has
ten unique digits, zero through nine.
Size example
• 1 bit - answer to an yes/no question
• 1 byte - a number from 0 to 255.
• 90 bytes: enough to store a typical line of text from a book.
• 4 KB: about one page of text.
• 120 KB: the text of a typical pocket book.
• 3 MB - a three minute song (128k bitrate)
• 650-900 MB - an CD-ROM
• 1 GB -114 minutes of uncompressed CD-quality audio at 1.4 Mbit/s
• 8-16 GB - size of a normal flash drive
Speed measurement: The speed of Central Processing Unit (CPU) is
measured by Hertz (Hz), Which represent a CPU cycle. The speed of
CPU is known as Computer Speed.
Computers classification***
Computers can be generally classified by size and power as follows,
though there is Considerable overlap:
• Personal computer: A small, single-user computer based on a
microprocessor. In addition to the microprocessor, a personal computer
has a keyboard for entering data, a monitor for displaying information,
and a storage device for saving data.
• workstation : A powerful, single-user computer. A workstation is like a
personal computer, but it has a more powerful microprocessor and a
higher-quality monitor.
• minicomputer : A multi-user computer capable of supporting from 10 to
hundreds of users simultaneously.
• mainframe : A powerful multi-user computer capable of supporting
many hundreds or thousands of users simultaneously.
• supercomputer : An extremely fast computer that can perform hundreds
of millions of instructions per second.
where f’s are the successive function applications which transform their
arguments which, at the start, is the initial data. LISP and ML are two
languages in use which support this model. LISP has been widely used to
program artificial intelligence applications. Another non-procedural class of
languages is called rule based languages or logic programming languages. A
logic program is expressed as a set of atomic sentences (known as facts) and
Horn clauses (if then rules). A query is then posed. Execution of the program
now begins and the system tries to find out if the answer to the query is true or
false for the given facts and rules. PROLOG is the best known language of this
type.
Problem Oriented Languages:
Problem oriented languages are designed to solve a narrow class of problems.
A user of such a language need not express in detail the procedure used to
solve a problem. Ready made procedures are pre- programmed. The user
merely presents the data in a flexible ‘language’. MATLAB is a very popular
language among scientists and engineers to solve a wide class of problems in
digital signal processing, control systems, modelling systems described by
differential equations, matrix computations etc. Another class of problem
oriented languages is for symbolic manipulation, for example, simplifying a
complex algebraic expression or getting the indefinite integral of a complex
expression. MATHEMATICA is a popular language of this type.
Classification Based on Applications:
Another method of classifying computer languages is by applications. The
major applications of computers are in the following areas: i. Business Data
Processing where large files are to be processed. COBOL has been the
dominant language in this area. We have seen, however, the emergence of
spreadsheet based ‘languages’ for answering ‘what if’ type questions.
Languages known as 4GLs (Fourth Generation Languages) are also used
which provide query languages to access data from data bases and
manipulate them. 4 GLs also have special features like ‘fill in the blanks’ to
obtain answers to queries and for designing good looking forms. ii. Scientific
applications require numeric intensive computing such as those used to solve
problems in science and engineering. Fortran 90 is the dominant language in
this area. C is making inroads. Recently Fortran 95 standard has been
published which incorporates features to write Fortran programs for parallel
computers.
The steps for creating and running programs are: writing/editing, compiling,
linking and execution. This can be viewed diagrammatically as shown below:
Writing/Editing: The first step in creating programs is, writing or editing the
program. A program can be written in any text editor like notepad. After writing
a program, the program must be saved, In C language, the program is saved
with the extension “.c”. This is the source program written in a high-level
language.
Compilation: After writing and saving the source program, the next step is
compilation. Here we will use a software called as compiler, which converts a
program written in high-level language into machine language. The resultant
file is known as an object file in C. The extension of that file is “.obj”.
Linking: After compilation the next step is linking. Here software called linker
is used. The linker links the program with external library files which contains
the code for predefined functions and creates an executable file. The
extension of the executable file is “.exe”.
Execution: Finally after the executable file is created after linking, the next
step is execution. The operating system executes the executable file which is
the machine code with the help of the CPU and other hardware components.
Problem Definition
Problem Analysis
Algorithm Development
Coding & Documentation
Testing & Debugging
Maintenance
1. Problem Definition
In this phase, we define the problem statement and we decide the boundaries
of the problem. In this phase we need to understand the problem statement,
what is our requirement, what should be the output of the problem solution.
These are defined in this first phase of the program development life cycle.
2. Problem Analysis
In phase 2, we determine the requirements like variables, functions, etc. to
solve the problem. That means we gather the required resources to solve the
problem defined in the problem definition phase. We also determine the
bounds of the solution.
3. Algorithm Development
During this phase, we develop a step by step procedure to solve the problem
using the specification given in the previous phase. This phase is very
important for program development. That means we write the solution in step
by step statements.
6. Maintenance
During this phase, the program is actively used by the users. If any
enhancements found in this phase, all the phases are to be repeated to make
the enhancements. That means in this phase, the solution (program) is used
by the end-user. If the user encounters any problem or wants any
enhancement, then we need to repeat all the phases from the starting, so that
the encountered problem is solved or enhancement is added.
Let’s take a look at the big picture of the software development process.
Computer programming is a cycle of designing, creating and supporting a
software. These are usually divided into the following sub-tasks:
Defining the task
It’s a common knowledge that a well defined task is half of the solution.
When you start a project you must know what exactly the customer expects.
The more detailed the description of the task - the better. Ideally, before the
start of the project you will have a blueprint( a plan) containing the design and
function of every page, form, button etc.
Coding
Finally it is time to write our program in the chosen computer language. Yes,
this is the step, where we actually create the program.
Debug
The first thing you need to do now is to find where the code fails. Most of the
time this is the most difficult part of the whole development.
Once you find the code that generates the problem you have to find why it
fails.
QA
Quality assurance is the time when the developer says: “Now it is working
and my job is done!”. It feels really great ;) QA is another test of the software.
It aims to assure that the product is working as the customer expects. This also
includes interface issues and others.
Usually this is not done by the developer. It can be done by a test script or a
QA engineer. It is important that the QA is not done by the developer, because
he is too much “in the program”. It is much easier for another guy to look at the
program by a different angle. This can make the product much more
user-friendly and easy to use. If the the product does not pass QA, it is
returned to the developer to fix the issues.
The last 5%.. Of course your software should be easy to install. Otherwise
the customer could turn it down before he even tried it. Support of the
product is the last and sometimes – the most expensive step of the cycle. The
better the support – the longer your customers will
be .. your customers ;-) Now that you have a good idea of the software
development process, it is time to continue with the next part of the guide.
Algorithm:
Step 1: Start
Step 4: Add num1 and num2 and assign the result to sum.
sum←num1+num2
Step 6: Stop
Flow chart:
What is a Flowchart?
Flowchart is a graphical representation of an algorithm. Programmers often use
it as a program-planning tool to solve a problem. It makes use of symbols which
are connected among them to indicate the flow of information and processing.
The process of drawing a flowchart for an algorithm is known as “flowcharting”.
Basic Symbols used in Flowchart Designs
1. Terminal: The oval symbol indicates Start, Stop and Halt in a
program’s logic flow. A pause/halt is generally used in a program logic
under some error conditions. Terminal is the first and last symbols in the
flowchart.
Flow lines: Flow lines indicate the exact sequence in which instructions are
executed. Arrows represent the direction of flow of control and relationship
among different symbols of flowchart.
Advantages of Flowchart:
Flowcharts are better way of communicating the logic of system.
Flowcharts act as a guide for blueprint during program designed.
Flowcharts helps in debugging process.
With the help of flowcharts programs can be easily analyzed.
It provides better documentation.
Flowcharts serve as a good proper documentation.
Disadvantages of Flowchart:
It is difficult to draw flowchart for large and complex programs.
In this their is no standard to determine the amount of detail.
Difficult to reproduce the flowcharts.
It is very difficult to modify the Flowchart.
Example : Draw a flowchart to input two numbers from user and display
the largest of two numbers
int main()
{
int num1, num2, largest;
return 0;
}
Output
Enter two numbers:
10 30
30
Flowchart is a diagrammatic representation of sequence of logical steps of a
program. Flowcharts use simple geometric shapes to depict processes and
arrows to show relationships and process/data flow.
Flowchart Symbols
Here is a chart for some of the common symbols used in drawing flowcharts.
Example Flowcharts
Here is the flowchart for going to the market to purchase a pen.
Advantages of Pseudocode
Improves the readability of any approach. It’s one of the best
approaches to start implementation of an algorithm.
Acts as a bridge between the program and the algorithm or flowchart.
Also works as a rough documentation, so the program of one developer
can be understood easily when a pseudo code is written out. In industries,
the approach of documentation is essential. And that’s where a
pseudo-code proves vital.
The main goal of a pseudo code is to explain what exactly each line of a
program should do, hence making the code construction phase easier for
the programmer.
3. The way the if-else, for, while loops are indented in a program, indent
the statements likewise, as it helps to comprehend the decision control
and execution mechanism. They also improve the readability to a great
extent.
Example:
if "1"
print response
"I am case 1"
if "2"
print response
"I am case 2"