Introduction
Introduction
MIHIR MISHRA
1
INTRODUCTION
What is computer?
It is an electronic device which accept data from out side world ( standard input devices)
and manipulates or process it at high speed according to instructions given.
It has memory to store large amount of data, can process it in accurate form with high
speed by using power full processor.
Computer is also called data processor because it can store, process and retrieve data
whenever required.
2
BASIC BLOCK DIAGRAM AND FUNCTIONS OF
COMPUTER
Secondary Memory 3
CENTRAL PROCESSING UNIT (CPU)
Central Processing Unit (CPU) is main part of computer system that contain electronic
circuitry that actually process the data.
Acting on the instruction it receives, the CPU performs operation on data.
It also controls the flow of data through the system, directing the data to enter the system
placing data in memory and retrieving them when needed, and directing the output.
CPU = ALU (Arithmetic logic unit) + CU (Control Unit)
ALU: Here actual execution instruction take place during processing operation.
It performs all arithmetic calculations and take logical decision.
It can compare, count, shift or other logical activities.
All such calculation and comparisons are done in this unit.
It takes data from memory unit and return information (process data) to memory unit if
4
storage require.
CENTRAL PROCESSING UNIT (CPU)
CU: It manages and coordinates operations of all other components of computer system.
It also perform following functions:
It retrieve instruction or data from memory.
It decode instruction.
It determine requirement of storage and take action according to it.
It also fetch instruction from main memory.
5
MEMORY UNIT
The storage unit of computer system store data for following purposes.
Processing data and instructions
Storage of temporary result (intermediate data storage)
Permanent storage for future requirement (secondary storage)
There are two types of storage:
Primary storage
Secondary or auxiliary storage
Primary storage:
Store current program or data (running program)
Store temporary data of current program
Less space in comparison of secondary storage
Volatile (data losses on power off)
6
Comparatively more expensive
Fast in operation
MEMORY UNIT
Secondary storage:
Used to store data and program for future usage.
Large capacity (GB/TB) in comparison with primary memory
Slower than primary memory
Retain data without power
Cheaper than primary memory
7
INPUT/OUTPUT
Basic aim of IO devices is to provide communication between computer and user.
Input device transmit the data as a series of electrical pulses into the computer memory
unit where it will be available for processing.
Input devices: keyboard, mouse, mic, webcam
Output devices supply result of processing from primary storage or secondary storage.
When a program executed and the results must be made available in a human readable
form.
The output device translate processed data from a machine coded form to a form that can
be read and used by people.
Output devices: monitor, printer, speaker
8
SOFTWARE
Computer software refers to collection of programs.
Program is the collection of instructions, which performs particular task and collection of
programs which accomplishes application is called software.
There are basically two types of software available:
System software
Application software
General purpose
Specific purpose software
9
SYSTEM SOFTWARE
Computer software refers to collection of programs.
System software is designed to control operation and extend the processing capabilities of
computer system.
They control internal computer functions, such as:
Reading data from input device
Transmit processing information to output devices
Provide various facilities likes file management
Input/Output management
CPU time to user program during execution of program
The help hardware component work together and provide support for development and
execution of application software.
Example: Operating System (OS), Compiler, Assembler, Loader, Linker, Translator, Macro 10
processor, Interpreters
APPLICATION SOFTWARE
A software designed for user specific need is called application software or application
package.
Example: Library management, school management, hospital management
They are developed with help of programming language or packages.
Some program direct the computer to perform specific tasks requested by user, such as
printing report of customize program, mail, store result etc., such program also called
application software.
There are two types of application software
General Purpose Software: General purpose :They are designed for many task and provide
many number of tasks and provides many features. For Ex: Microsoft Office
Specific Purpose Software: The packages pay roll, financial accounting, inventory control
are some of the specific purpose software.
11
The pay roll packages developed for an organization following a set of rules and may not
apply to another organization as the pay calculation rules varies.
COMPILER VS. INTERPRETER
Compiler Interpreter
Compiler scan the whole program at a time and Interpreter scans the program line by line and
lists out errors if any. stop scanning whenever error occurs.
Compiler converts the whole source code into Interpreter converts the source program line
object code at a time. by line.
After compilation, source code is not required.
For every execution run source is required.
Execution is faster.
Execution is slower
The object code is generated when the program
No object code file is generated.
is error free.
Compiler converts high level language into low Interpreter converts high level language to
level language (Whole code is converted). low level language, line by line.
12
PROGRAMMING LANGUAGES
Language is system for communicating.
Written languages use symbols (characters) to build words.
The entire set of words is language's vocabulary.
The way in which words can be meaningfully combined are defined by the language's
syntax and grammar.
The actual meaning of words and combinations of words is defined by the language's
semantics.
Programming language is a vocabulary and set of grammatical rules for instructing
computer to perform specific tasks.
It is classified as:
Machine language or Low level language
Assembly Language 13
Drawback/Disadvantage
14
It require depth technical knowledge to debug program.
Due to only two combination (0's and 1's) it is difficult to understand.
ASSEMBLY LANGUAGE
It is also classified as low - level language.
This language uses mnemonics in place of O's and I's to represent codes.
Example:
LDA A
ADD B
STR C
Symbolic presentation makes easy to write program
Limitations
Coding in this language is time-consuming
This language is machine-oriented i.e. they are designed for specific make and model of processor 15
being used.
HIGH LEVEL LANGUAGE
These are the languages whose instructions closely resemble human language and
mathematical notation.
Unlike assembly language, programs made in this language may be used with different makes
of computers with little modification.
Advantages
Easier to learn
Requires less time to write
Provides better documentation
Easier to maintain
As a result, high level languages are used more often than machine or assembly languages.
High level languages must also be translated in to machine language before they can be used
by a computer. 16
One of the two different language-translator program is used to translate high-level language:
compiler and interpreter.
ALGORITHM
An algorithm is a finite sequence of well defined steps or operations for solving a problem
in systematic manner.
These are rules for solving any problems in proper manner.
Instruction are written in the natural language.
It is also called step by step solution.
Properties/Characteristic:
Finiteness
Definiteness
Effectiveness
Input/Output
17
WRITE AN ALGORITHM TO FIND OUT SUM OF TWO
NUMBERS
18
WRITE A ALGORITHM TO FIND OUT ARE OF
SQUARE
19
WRITE AN ALGORITHM TO FIND AVERAGE OF THREE
NUMBERS
20
WRITE AN ALGORITHM TO FIND WHETHER GIVEN NUMBER IS
POSITIVE OR NEGATIVE.
21
WRITE AN ALGORITHM TO FIND OUT MINIMUM NUMBER
FROM THREE INPUT NUMBERS
Start/Stop 23
FLOWCHART
Input/Output
Process or Expression
Condition
Decision 24
FLOWCHART
Flow Lines
Connector
Loop 25
DRAW A FLOWCHART TO FIND OUT SUM OF TWO NUMBERS
Start
Input: a,b
sum = a+b
Print “Sum
=”, sum
26
Stop
DRAW A FLOWCHART TO FIND OUT SUM OF TWO NUMBERS
27
DRAW A FLOW CHART TO FIND AREA OF RECTANGLE
Start
Input:
length,
width
Area
=Length*width
Print “Area
=”,Area
Stop
28
DRAW A FLOW CHART TO FIND AREA OF RECTANGLE
29
DRAW A FLOWCHART TO FIND AVERAGE OF 3 SUBJECTS
MARKS
Start Start
Input: Input:
a,b,c a,b,c
Print “Ävg
of 3 sub
=”,Avg
Avg = sum/3
30
Stop
DRAW A FLOWCHART TO FIND AVERAGE OF 3 SUBJECTS
MARKS
31
DRAW A FLOWCHART TO FIND MAXIMUM NUMBER FROM
TWO NUMBERS
Start
Input:
a,b
True a>
False
b
Print Print
“Max=”,a “Max=”,b
32
Stop
DRAW A FLOWCHART TO FIND MAXIMUM NUMBER FROM
TWO NUMBERS
33
DRAW A FLOW CHART TO FIND WHETHER GIVEN NUMBER IS
ODD OR EVEN
Start
Input:
n
n
True % False
2
==
0
Print Print
“Given no “Given no
is even” is odd
34
Stop
DRAW A FLOW CHART TO FIND WHETHER GIVEN NUMBER IS
ODD OR EVEN
35
DRAW A FLOW CHART TO FIND MAXIMUM NUMBER FROM
THREE DIFFERENT NUMBERS
Start
Input:
a,b,c
Stop
37
DRAW A FLOW CHART TO FIND MAXIMUM NUMBER FROM
THREE DIFFERENT NUMBERS
38
DRAW A FLOW CHART TO FIND ROOT OF EQUATION:
AX2+BX+C
Start
Input:
a,b,c
2
𝑑=𝑏 − 4 𝑎𝑐
A B 39
DRAW A FLOW CHART TO
A B
X1=
Display
“Roots
are -ve”
X2=
Display
X1, X2
40
DRAW A FLOW CHART TO FIND WHETHER GIVEN NO. IS +VE OR -VE
Start
Input:
n
True n False
<
0
41
Stop
DRAW A FLOW CHART TO FIND FACTORIAL OF GIVEN NO.
42