Académique Documents
Professionnel Documents
Culture Documents
2
In computing, a program is a specific set of
ordered operations for a computer to
perform.
Program is a sequence of instructions, written
3
The process of developing and implementing
various sets of instructions to enable a
computer to do a certain task.
These instructions are considered computer
4
A programming language is a set of rules
that provides a way of telling a computer
what operations to perform.
5
English is a natural language. It has words,
symbols and grammatical rules.
A programming language also has words,
6
◦ Low-level languages
◦ High-level languages
7
It is a programming language that deals with
a computer's hardware components and
constraints.
It may also be referred to as a computer’s
native language..
Programs written in low-level language are
8
low level language is machine language which
are not understandable by the programmer or
say user
this is in the form of 0's & 1's or symbolic
codes
totally machine dependable
vary from computer to computer.
9
Faster execution
No need of language translator
Disadvantage
Machine dependent
Hard /difficult to program.
Difficult to debug.
10
It can be further divided into 2 types:
◦ Machine language(1Gl)
◦ Assembly language(2Gl)
11
Uses binary number system
0s and 1s for electricity off / on
Machine language is machine dependent as
it is the only language the computer can
understand.
Very complex for coding
No need of language translator so faster in
execution
12
Symbolic operation codes (mnemonics
codes) replaced binary operation codes.
Assembly language programs needed to
be “assembled” for execution by the
computer. Each assembly language
instruction is translated into one machine
language instruction ,
Very efficient code and easier to write
More standardize and easier than
machine language
13
• The high-level languages are much closer to human
language.
• It is an English like language.
• A programming language such as C, FORTRAN or
Pascal that enables to write programs which is
understandable to programmer (Human) and can perform
any sort of task, such languages are considered high-level
because they are closer to human languages.
• High level language must use interpreter or compiler
(language translator) to convert human understandable
program to computer readable code (machine code).
14
Easy to learn
Easy to find errors
Machine-Independent
Shorter Programs
Well-Defined Syntax and Standard
Source code understandable by any other
programer
15
•These are simple to adopt due to their english like
structure of statements.
•They are easy to maintain and debug.
Disadvantages
•The Program written in high level language are less efficient
as they take more execution time.
•The compiler also consumes some memory as it is required
16
PROCEDURE ORIENTED LANGAUGE(3GL)
PROBLEM ORIENTED LANGUAGE(4GL)
NATURAL LANGUAGE(5GL)
17
This programming language uses the list of
computer instructions to tell the computer what to
do step by step.
General purpose programming languages are
called procedural languages or third generation
languages e.g.. Pascal, Cobol, Fortran, Basic etc.
Statements are in English, easy to work
Programs written 3GL require more memory and run more slowly
than those written in lower level languages.
English language so it takes less time to program
Once coded easy to understand and modify
Languages are machine independent
Needs translator to convert it into machine codes.
18
Problem oriented (4GL) that requires fewer
instructions to accomplish a task than a
procedure oriented language(3GL).
It is designed to solve specific problems or
develop specific application by enabling
what you want rather than step by step
procedures
Used with databases
examples
◦ Query languages(oracle, MY-SQL, etc)
◦ Application generators(c++,java, etc)
19
Still in development stage
It is the natural more human like
Allow the computer to become smarter
Most popular natural language are LISP and
Prolog.
It is used in the field of robotics, experts
20
Any program that is not written in machine language has to
be translated in machine language before it is executed by the
computer. Language translator is a system software that
translate the language written in Assembly language or high
level language into the machine code.
There are three types of translator programs.
Assembler,
Compiler and
Interpreter
21
• An Assembler is a language translator that coverts the
program written in assembly language into the machine
code.
22
• an interpreter is a language translator that converts the
source code written in high level language into the
machine code one line at a time.
23
•A compiler is a language translator that coverts
the source code written in high level language
into the machine code(object code) at once.
•Machine code is called object code and can be
saved and either run immediately or later.
24
Complier Interpreter
1. It translate the whole program 1. It converts one line or single
into object code. statement of a program into the
object code at a time.
2.It traps the errors after compiling 2. It traps the errors after
the complete program. translating a line of the program at
a time.
3. The translation process is faster. 3. The translation process is
slower.
4. It saves the object code for 4. It does not save the object code.
future reference.
5. It is usually larger program and 5. It is usually smaller program and
requires larger memory space. requires less memory space.
6.Examples of complier based 6. Examples of interpreter based
programming language are C, C+ programming languages are BASIC,
+, Java, Pascal, FORTAN etc. C#, PHP etc.
25
An operation is an action performed on one
or more values either to modify the value
held by one or both of the variables or to
produce a new value by combining variables.
Therefore, an operation is performed using
operator.
A variable or a value involved in an operation
is called an operand.
26
Simple answer can be given using
expression 4 + 5 is equal to 9. Here 4 and 5
are called operands and + is called operator.
Some common type of operators are:
Arithmetic Operators
Logical and Relational Operators
27
Operator Description Example
+ Adds two operands A + B will give 30
28
== Checks if the value of two operands is (A == B) is not
equal or not, if yes then condition true.
becomes true.
!= Checks if the value of two operands is equal (A != B) is true.
or not, if values are not equal then condition
becomes true.
> Checks if the value of left operand is greater (A > B) is not true.
than the value of right operand, if yes then
condition becomes true.
< Checks if the value of left operand is less than (A < B) is true.
the value of right operand, if yes then
condition becomes true.
characteristics.
Some of common data types are
integers,
Booleans,
characters,
floating-point numbers,
alphanumeric strings.
31
Variables
A variable is something that may change in
value.
Those quantity whose values are changed
during program execution is called variable
A variable might be the number of words on
variables is:
INTEGER namel, name2
32
Constants are quantities whose values do not
change during program execution
Example
Area=3.14*r *r where 3.14 is constant.
33
Programme
&
Logic
34
Program Logic:
It is the method or technique to process a program in
which user write program with reasons, techniques and
methods known as program logic.
35
36
Algorithm
Flowchart
Pseudo code
37
An algorithm is defined as a step-by-step
sequence of instructions that must terminate
and describe how the data is to be processed
to produce the desired outputs.
Algorithms are a fundamental part of
computing.
38
A set of step-by-step instructions to
accomplish a task.
Point to remember while writing an algorithm
39
• Flowchart is a visual/pictorial
representation of the sequence of the
instructions to solve a problem/task.
• In short we can say it is a diagrammatic
representation of an algorithm
• It shows what comes first, second, third and
used to
Analyzing,
Designing,
Documenting ,
and Managing a process or program
40
System flowchart
Program flowchart
41
Program flowchart : A program flowchart
details the flow through a single program.
Each box in the flowchart will represent a
42
43
44
Example 1: - Draw flow chart of an algorithm
to add two numbers and display their result.
start
Read two numbers (A and B)
Add A and B
Assign the sum of A and B to C
Display the result ( c)
stop
45
Start
Read A, B
C= A+B
Print C
End
46
47
Example 3: - Write the algorithmic description
and draw a flow chart to find the following sum.
Sum = 1+2+3+…. + 50
Algorithmic description
1. Initialize sum too and counter to 1
◦ If the counter is less than or equal to 50
◦ • Add counter to sum
◦ • Increase counter by 1
◦ • Repeat step 1.1
◦ Else
• Exit
2. Write sum
48
49
Step 1:start
step 2: Read two numbers (A and B)
Step 3:C = A + B
step : 4Display the result ( c)
Step : 5Stop
50
Start
Read A, B
C= A+B
Print C
End
51
Start
read number n
Is(n
mod
true 2==0)
false
End
52
2)system flowchart : A system flowchart shows
a broad view of the data flow and sequence of
operation in a system.
It illustrates the element graphically and
53
54
55
• Sequential Processing:
These instructions do the actual data processing in
sequence order, such as input, add/subtract, copy and
output.
• Decision Making:
The decision making within the program is the process of
comparing or evaluation of two sets of data of the
program based on the results.
• Iteration:
Many routines must be repeated for some number of times
and are accomplished with the help LOOPS till the
desired result.
56
57
It is fake or false code which looks like
programming code.
It uses English phrases to describe the
58
Pseudo code Structure
59
Writing of pseudo code involves much
less time and effort than drawing an
equivalent flowchart.
Converting a pseudo code to a
60
In case of pseudo code, a graphic
representation of program logic is not
available.
There are no standard rules to follow in
using pseudocode.
Different programmers use their own
61
Testing is the process of executing programs
with the intention of finding errors.
62
TYPES OF TESTING
1. Unit Testing Verifies each individual program works
by itself
2.Integration testing
Combine each units and verify it
63
Bugs are called errors.
In computers, debugging is the process of
64
Syntax errors:
Semantic errors(logical Errors):
Run time errors
65
errors due to the fact that the syntax of the
language is not respected.
When a programmer doesn't stick on to the
grammar' specifications of a computer language, a
syntax error results.
These kinds of errors are easily rectified during the
compilation phase.
Syntax errors are easy to find and correct because
the development system(program translator) finds
them for you.
◦ Example 1: Missing semicolon in c programming
◦ int a = 5
◦ In this error compiler will generate a message: semicolon is
missing
66
Semantic errors: errors due to wrong program
logic/idea/concept . It is also called logical error.
If you write a statement that is syntactically correct,
67
Run time errors are detected while the
program executes.
These are often discovered when the user
text are
i. Absolute binary
ii. BCD
iii. EBCDIC
iv. ASCII
v. UNICODE
69
We represent +ve and -ve number by sign like
-45 and +45. but in computing, it is not
possible.
So In absolute binary, 0 is placed before binary
number to represent positive and 1 is placed
before number to represent negative
number.
The most significant bit denotes the sign bit
and rest of bit represent the original number.
+45 is represented as 0101101.
-45 is represented as 1101101.
70
In computing, binary-coded decimal (BCD) is a
class of binary encodings of decimal numbers
where each decimal digit is represented by a fixed
number of bits, usually four or six bits.
Example
Converting 4019 to 4 bit BCD
4=0100
0=0000
1=0001
9=1001
4019=(0100000000011001)
71
It is an 8-bit character encoding used mainly
on IBM mainframe and IBM midrange
computer operating systems.
It is an extended version of BCD.
Since 4 and 6-bit BCD could not represent all
72
DEC HEX EBCDIC ASCII BINARY
066 42 â B 0100 0010
067 43 ä C 0100 0011
73
ASCII stands for American Standard Code for
Information Interchange, is a character-
encoding scheme.
Originally based on the English alphabet, it
74
Unicode is an entirely new idea in setting up binary
codes for text or script characters.
Officially called the Unicode Worldwide Character
Standard.
It is a system for "the interchange, processing, and
display of the written texts of the diverse languages
of the modern world."
It also supports many classical and historical texts
in a number of languages.
Currently, the Unicode standard contains 34,168
distinct coded characters derived from 24
supported language scripts.
These characters cover the principal written
languages of the world.
75