PPS - Unit 1 (1)
PPS - Unit 1 (1)
UNIT-1
Introduction To Computer And Programming
Prepared By:
Sheetal J. Nagar,
5. Concepts of
6. Flowcharts
7. Algorithms
1.
Introduction
What is Computer?
▪ The word computer comes from the word “compute”, which means, “to
calculate”.
▪ A computer is an electronic device that can perform arithmetic operations at
high speed and it can process data, pictures, sound and graphics.
▪ It can solve highly complicated problems quickly and accurately.
▪ Computer can not do anything without a Program.
▪ Charles Babbage is called the "Grand Father" of the computer. The First
mechanical computer designed by Charles Babbage was called Analytical
Engine. It uses read-only memory in the form of punch cards.
What is Computer?
▪ Computer is an advanced electronic device that takes raw data as input from
the user and processes these data under the control of set of instructions
(called program) and gives the result (output) and saves output for the future
use.
Control Unit
Memory Unit
(RAM, ROM Etc…)
Storage Devices
(Hard disk, Pen drive etc…)
Four components of Computer
a) ALU
b) CU
c) MU
2. Input Devices
3. Output Devices
4. Storage Devices
1) Central Processing Unit
▪ CPU is the main part of the computer that contains electronic circuitry
2) CU
3) Memory Unit
1) Central Processing Unit
1) ALU (Arithmetic and Logic Unit):
- It performs all arithmetic calculations and takes logical decision.
- It can perform add, subtract, multiply, compare, count, shift and other logical activities.
- It takes data from the memory unit and performs calculations and returns data.
- Calculations are performed very fast.
2) CU (Control Unit):
- Controls all the operations performed in computer.
- It reads instructions from the memory,
- It decodes the instructions and
- executes the instructions.
- It also coordinates the time and sequence of the instructions among various components.
1) Central Processing Unit
3) Memory Unit:
- CPU contains primary memory RAM and ROM.
- Its storage capacity is very small compared to secondary storage.
- It is very fast in an operation compared to secondary storage
- RAM ➔ Random Access Memory
Can be Read and Write
Volatile Memory (It cannot retain data without power)
It means data will be lost in case of power failure or system crash.
So It stores data on temporary basis.
- ROM ➔ Read Only Memory
We can’t write in it.
Non volatile memory (It can retain data without power)
ROM is an integrated circuit programmed with specific data when it is manufactured.
2) Input Devices
▪ The devices which are used to enter the data into the computer from the outside world.
– Mouse – Joystick
▪ Mouse is a pointing device which points at the desired position on the screen, it gives
▪ The output device translates the data from a machine coded form (in 1s and 0s) that
- Printer
- Plotter
- Speakers
4) Storage Devices
We can see and touch hardware as they are We can see (if there is a user interface) and use
3
physical electronic devices. software but can’t actually touch them.
Hardware is required to not only process data Software gives the hardware necessary
4 but also to take input and send output and instructions to perform the tasks of input, output
store output. and processing
1) System software
2) Application software
▪ It controls hardware as well as interacts with users, and provides different services to user.
▪ For example drivers of the I/O devices or Anti virus Software, etc…
System Application
software software
- preprocessor
5.
Types of Programming languages
Programming languages
6. As Binary code (Instruction Set) varies from machine to machine, Programs written in
Machine Language are not portable.
7. Program written in Binary code for one machine, will not work for other machine.
1) Machine Level Programming
Advantages
▪ It is very fast in execution
▪ It does not require any extra system or software to run the program.
▪ Translation is not required.
▪ Suitable for low volume applications.
Disadvantages
▪ Requires depth technical knowledge to debug program.
▪ Difficult to understand.
2) Assembly language
1. Uses MNEMONIC (English word like ADD, SUB, MUL, DIV etc.) instead of 0’s
and 1’s.
Disadvantages
▪ It is not portable.
▪ Programmer should know structure of assembly language of
microprocessor.
▪ It requires assembler as a translator.
3) Higher level language
2. Programmer can perform complex task by using high level languages with
less efforts.
▪ The flow chart symbols are linked together with arrows showing the process
flow direction.
Purpose Symbol
Start/Stop
Input/Output
Flowchart
Symbols Process
Decision Making
Connectors
Arrows
Ex.1) Start
Flowchart to find Total
Input a, b, c
and Average of 3
numbers
Total = a + b + c
Stop
Ex.2)
Flowchart to find Start
Simple Interest.
Input R, P, N
Interest = ( R * P * N ) / 100
Print Interest
Stop
Ex.3) Start
Flowchart to find
Input a
whether a number is
odd or even Yes No
If (a % 2 == 0 )
Stop
Start
Ex.4)
Flowchart to find Input a
whether a number is
Yes No
Positive, Negative or if (a>0)
Zero.
Yes No
if (a<0)
Print
“Positive”
Print Print
“Negative” “Zero”
Stop
Start
Ex.5)
Flowchart to find Input a, b
Maximum among 2
Yes No
numbers if (a>b)
Stop
Ex.6) Start
Flowchart to find
Input a,b,c
Maximum among 3
numbers. Yes No
if (a>b)
Yes No Yes No
if (a>c) if (b>c)
Stop
7.
Algorithm
Algorithm
▪ “An algorithm is a step by step solution of any problem”.
Step 6 : Stop
Ex.2)
Step 1 : Start
Algorithm to find
Step 2 : Input P, R, N
Simple Interest.
Step 3 : Calculate Interest = ( R * P * N ) / 100
Step 5 : Stop
Ex.3)
Step 1 : Start
Algorithm to find
whether a number is Step 2 : Input a
else go to Step 5
Step 6 : Stop
Step 1 : Start
Ex.4)
Step 2 : Input a
Algorithm to find
whether a number is Step 3 : Check if(a>0) then go to Step 4
else go to Step 7
Step 8 : Stop
Ex.5) Step 1 : Start
Algorithm to find
Step 2 : Input a,b
Maximum among 2
Step 3 : Check if(a>b) then go to Step 4
numbers
else go to Step 5
Step 6 : Stop
Ex.6) Step 1 Start
Flowchart and
Step 2 Input a
Algorithm to find
Maximum among 3 Step 3
Yes No
numbers. if (a>b)
Step 4 Step 7
Yes No Yes No
if (a>c) if (b>c)
Step 10 Stop
Ex.6) Step 1 : Start
Algorithm to find Step 2 : Input a,b,c
▪ A user can use c language to develop System level programs (for writing