Professional Documents
Culture Documents
Communication Technology
Class XI-XII
Chapter-5
Programming Language
Programming language
Program: A set of sequentially arranged instructions
to solve a particular problem is called Program.
#include<stdio.h>
main()
{
int A,B,S; //variable declaration
scanf( “ %d %d ” , &A, &B); Input
Processing S=A+B;
printf( “%d” , S); Output
}
Characteristics of a good program or
Features of a standard/ideal program
ADD= Addition
SUB= Subtraction
MUL = Multiply
DIV= Division
MOV= Move
LDA = Load
STP= STOP
Opcode Source Operand
ADD AX,Y
Destination Operand
MOV AX , A
ADD AX , CX
MOV DX, D
ADD AX, DX
Example : ( A * B )+ (C * D)
MOV AX , A
MOV BX , B
MUL AX , BX
MOV CX , AX
MOV AX , C
MOV BX , D
MUL AX , BX
ADD AX , CX
Advantages of assembly language
Almost direct communication with
computer
Works faster (but slower than machine
language )
Easier than machine language
Writing program is fast
Requires less memory spaces
Disadvantages of assembly language
Hard to write a program (although easier
than machine language)
Need to learn about internal structure of
computer
Program written for one specific model
may not run in another model of
computer
Requires more time to run (since needed
to translate in machine language)
3rd Generation Programming Language
Example:
C/C++, JAVA, C# etc
Advantage of high level language
Easy to write a program
Less time for writing a program
Chance to do mistake/error is low
Debugging is easy
No need to learn about internal
structure of computer
Program written for one specific model
runs in another model of computer
Disadvantages of high level language
1 Shuvo 5.00
2 Riad 4.88
3 Abir 4.50
4 Soha 4.88
4GL
Fourth Generation Languages are also
known as very high level languages.
Example:
SQL, Oracle, MS Access
HTML, DHTML, PHP,ASP
Any language with English-like commands
that does not require traditional input-
process-output logic falls into this category.
Examples:
SQL (Structured Query Languages)
Visual Basic, Oracle
Markup languages like HTML and XML
A fifth generation programming language
Translator
#include<stdio.h>
main() 0101010101001
{ 110001
Compiler 1010100101010
printf(“Hellow World”);
} 010101010
01011
An imaginary example of Interpreter !
START
1101
PRINT “Hello World”
Interpreter 111101010111
END
1110
Assembler
MOV AX , B 1010101010101
MOV BX , C 1010100101010
MUL AX , BX 000100101011
1010111010101
MOV BX , A Assembler 101111101110
ADD AX , BX 1010100101111
MOV BX, D 10101011111111
ADD AX, BX
Assembler
Assembly
Language Assembler Machine
Language
Compiler:
Translate high level language program into low level
machine language
Take entire program at a time
Interpreter:
Translate high level language program into
intermediate code
Take one line (or one statement) at a time
Assembler:
Translate assembly language program into low level
language
Interpreter
Compiler
Compiler Vs Interpreter
Compiler Interpreter
1. Translate high level 1. Translate high level
language program into low language program into
level machine language intermediate code
Compiler Vs Interpreter
Compiler Interpreter
1. Translate high level 1. Translate high level
language program into low language program into
level machine language intermediate code
2. Take entire program at a 2. Take one line (or one
time statement) at a time
Compiler Vs Interpreter
Compiler Interpreter
1. Translate high level 1. Translate high level
language program into low language program into
level machine language intermediate code
2. Take entire program at a 2. Take one line (or one
time statement) at a time
3.Works faster 3. Works slower
Compiler Vs Interpreter
Compiler Interpreter
1. Translate high level 1. Translate high level
language program into low language program into
level machine language intermediate code
2. Take entire program at a 2. Take one line (or one
time statement) at a time
3.Works faster 3. Works slower
4. All errors (bugs) are 4. Error message shown
shown together when any error is found
Compiler Vs Interpreter
Compiler Interpreter
1. Translate high level 1. Translate high level
language program into low language program into
level machine language intermediate code
2. Take entire program at a 2. Take one line (or one
time statement) at a time
3.Works faster 3. Works slower
4. All errors (bugs) are 4. Error message shown
shown together when any error is found
5. Debugging is harder 5. Debugging is easier
Compiler Vs Interpreter
Compiler Interpreter
6. Larger translator program 6. Smaller translator program
Compiler Vs Interpreter
Compiler Interpreter
6. Larger translator program 6. Smaller translator program
7. Requires more memory 7. Requires less memory
spaces spaces
Compiler Vs Interpreter
Compiler Interpreter
6. Larger translator program 6. Smaller translator program
7. Requires more memory 7. Requires less memory
spaces spaces
8. Translate into machine 8. Translate into intermediate
language or Object program. code. So the work is not fully
So the work is fully completed completed.
Compiler Vs Interpreter
Compiler Interpreter
6. Larger translator program 6. Smaller translator program
7. Requires more memory 7. Requires less memory
spaces spaces
8. Translate into machine 8. Translate into intermediate
language or Object program. code. So the work is not fully
So the work is fully completed completed.
9. Once a program is 9. Intermediated code is
translated not needed to needed to be translate again
translate again (if no change is for producing machine
made in source code) language.
Compiler Vs Interpreter
Compiler Interpreter
6. Larger translator program 6. Smaller translator program
7. Requires more memory 7. Requires less memory
spaces spaces
8. Translate into machine 8. Translate into intermediate
language or Object program. code. So the work is not fully
So the work is fully completed completed.
9. Once a program is 9. Intermediated code is
translated not needed to needed to be translate again
translate again (if no change is for producing machine
made in source code) language.
10. Used In C programming 10. Used In QBasic
programming
3 steps of Program organization
INPUT A, B INPUT
Process:
process the data according to instructions
Output:
after processing the result is to be shown
INPUT A, B INPUT
S = A+B PROCESSING
PRINT S OUTPUT
A simple C Program for adding two numbers
#include<stdio.h>
main()
{
int A,B,S;
scanf( “ %d %d ” , &A, &B); Input
Processing S=A+B;
printf( “%d” , S); Output
}
Steps of developing a program
1.Problem Specification
2. Problem Analysis
3. Program Design
4. Program Development
5.Program Implementation
Input design
Output design
Find the relation between Input
& Output
4. Program Development
Syntax errors
Semantic/Execution/Runtime error
Logical errors
Linker error
Types of errors
Syntax errors: errors due to the fact that the syntax
of the language is not respected.
Sum=A+B
if(a>b);
int 2b;
Semantic/Execution/Runtime error: errors due to
an improper use of program statements. Like:
Divided by zero
The loop is infinite
Square root of negative number
Array overflow
Logical errors: errors due to the fact that the
specification is not respected.
Use of > instead of <
Use of R= A * B, instead of R= A/B;