You are on page 1of 15

INTRODUCTION TO COMPUTER

Assignment Topic: Programming Languages


Submitted to:

Miss. Amna

Submitted by:

Kiran Munawar

Roll No:

201465

Program:

B.S Urdu

Part/Semester:

2/3

Lahore College for Women University Lahore.

TABLE OF CONTENTS

Introduction
Flow Chart
Symbols of Flow Chart.
Programming Languages.
Low-Level Languages
High-Level Languages
Languages Processors.
12
Compiler
Interpreter
Assembler
Difference between Compiler and Assembler

3
3
4
8

PROGRAMMING LANGUAGES
Introduction:
The computer programming involves designing the computer
program (software) to solve different kind of problems as well as to control
different operations of the computer. A computer is nothing without a
computer program. A computer program is designed after understanding the
program. We must be clear about the processing steps to be performed by a
computer. It mean that we must understands the logic of the program.
Before writing a computer program, we must learn how to plan the logic of
program.
For example to find out the average marks of a student, the
steps required to solve problem and their sequence are given as under:

Get the marks of all subjects of all the students.


Calculate the total marks.
Calculate the total marks.
Calculate the average marks.
Print the average marks.
The same principle applies while writing a computer program.

The program instructions are written in such a way that the computer can
execute the program instructions in the correct order to solve the problem
successfully.
Thus, to develop correct (or effective) program, the programmer must write
program instruction in the proper sequence. If the program instruction are
3

written in any incorrect sequence, then the program output will be


incorrect. Therefore, programs must be planned before they are written.

FLOWCHART
The graphical or symbolic representation of solution of a
problem is called flowchart. In other words, flowchart is graphical
representation of algorithm or pseudopods.
Flowchart is the most commonly used method for describing
the solution of a problem. It is very easy to understand for anyone. It gives a
quick overview about the solution of problem.
Flowchart is similar to the map of a building. The designer
makes a map of building before starting construction on it. Similarly, a
computer programmer draws a flowchart of a problem before writing the
actual computer program for solution of the problem. The programmer
writes the program by following the flowchart.
Basically, Flowchart is a plan to be followed for coding a
program. It is recommended that the students and programmers must
create a flowchart before writing the code of the program. Errors in the logic
for the program can be detected very easily in flowchart.

Symbols of flowchart
Each step in solving the problem is represented by a different
symbol. Each symbol also contains a short description about the step. The
flowchart symbol are linked together with arrows that show the direction of
flow data or control.
The important standard symbols that are commonly used to draw
flowcharts are described below:

1.

Flow Lines

The line with an arrowhead is used to represent the direction of


flow in the flowchart. Typically, it shows the flow of data. There
are four types of flow lines.

2.

Start/End

An oval shape symbol is very use to represent start as well as

End of a flowchart. This symbol contains the START or END.

START

END

3.
Input/output
A parallelogram symbol is use to represent Input or output step
in
PRINT X etc.

the
INPUT X,Y

flowchart.

Example:

INPUT

X,

PRINT X,Y

4. Processing

The processing or computation step in the flowchart is


represented by a symbol of rectangular block. The process step

is

usually used as an assignment statement. Examples: X=X+1, Y

0 etc.

S=S+10
5.

S=0

Selection
A diamond symbol is used in the flowchart for representing
selection or decision. This symbol is unique in that it has two
arrow coming out of it. One arrow corresponding to Yes or True,
and one corresponding to No or False. The arrows should always
be labeled with True/False or Yes/No.

False

True
5

6.

Connector

to

join various parts of a flowchart. A number is written inside the

A connector symbol is representing by a small circle. It is used

circle to identify the position where the connector joins or leaves


the flowchart.
3

7.

Off-Page/On-Page connector
This symbol is used for a lengthy flowchart that does not fit on
single page. This symbol shows the continuity of flow chart to
next page. The symbol of Off-Page/On- Page is given below.

8.

Pre-defined process

This symbol is used to call a function or solution in the main


program to perform a specific task. The symbol of pre-defined
process is given below.

9.

Remarks
The remarks or comments can also be given in the flowchart.

The

symbol for remarks or comments is given below.

----------------

Flowchart Examples
1.
A flowchart to input two numbers, calculate the sum and prints
the result.
START

INPUT A
INPUT B

C=A+B
PRINT C
END

2. A flowchart to test if number A is greater than B is given


below:
START

INPUT A
INPUT B

IF
PRINT- B

A>B
PRINT A

STOP

3. Flowchart to print the even numbers from 1 to 20 is given


below.

START
N=2
PRINT N
N=N + 2

IF
N<=20

STOP

PROGRAMMING LANGUAGE

A language is defined as the way of communication between

two persons. Programming language is a means of communication between


computer and user. A computer program is written or prepared in
programming language.
Early computer programs were prepared directly in machine
Language I.e. in binary code. Today many programming languages are
available for writing different types of programs. Each programming
language has a set of alphabets are rules for writing computer are divided
into two types
I.
Low-level languages
II.
High-level languages

Low-level languages
The programming language that are close to machine code (0s
and 1s) are called Low-level programming language. This language are
difficult to learn and use. The program instructions written in these
language are in binary form. Low-level language provide the programmer
with a high degree of control over hardware but they require are deep
knowledge of the internal structure of the hardware to be used. The example
of low-level programing language are machine and assembly language.

1.

Machine language

The type of language in which program instructions are written


in binary form is called machine language. It is the fundamental
language of the computer. It means that computer only
understand the machine language.
Machine language is not easy to learn. It is difficult to write/
modify program in machine language. It is also difficult to
find

and remove errors in the program written in machine language.


A program written in machine language machine is -dependent.
Every computer has its own machine language. The program
written in machine language is executed very fast.

2.

Assembly Language
Assembly language is a low-level language. It is very close to
machine language. In this language, programs instruction are
written by using short names (or symbols) Knows as mnemonics
(Pronounced as Ne-Monics). Assembly language facilities for
controlling the hardware.
The program written in assembly language cannot be run

directly

on the computer. It is translated into machine codes with

the help

of translator program known as assembler. Assembly

language is

also different for different computer.

High-Level Language
The programming languages that are close to human languages
are called high-level language. These languages are easy to learn and use.
Example of high level languages are, FORTARN, COBOL, BASICS, PASCAL,
CC++ etc.

These language are similar to English language. The program


instruction are written using English words, e.g. Print, input etc. But each
high-level language has its own rules or grammar for writing program
instruction. These rules are called syntax of the language. The program
written in high-level language must be translated to machine before running
on the computer. Each high-level language has its own translator program.
The high-level programing languages are further divided into:
a.
b.
c.

Procedural languages.
Non-procedural language.
Object- oriented languages

Procedural languages
Procedural languages are also known as third-generation
languages (3GLs). In procedural languages, the program instructions are
executed in a sequence in which they are written. It means that order of
program instruction is very important. Some popular procedural languages
are FORTRAN, COBOL, PASCAL, LISP, and C/C++.

1. FORTRAN
Fortran stands for Formula Translation. It was the first highlevel languages. It is generally used for scientific purposes and to
solve
mathematical problems.

2. COBOL
Cobol stand for common business oriented language. The high
level languages is used for writing program for business use. It
is very popular in business field

3. PASCAL

10

Pascal is a high level languages. This languages is named in the


honor is scientist Pascal. It is very popular language in scientific
field.

4. C
C is high-level language. This language is commonly language
used for developing operating systems and application
programs. The popular operating system UNIX, windows,
Macintosh and DOS etc. are developed in C.

5.

LISP
LISP stands for list processing. It is high-level language. It is

used

for developing expert systems. It is also used to develop

computer

games.

6.

Basic
BASIC stands for beginners all-purpose symbolic instruction
code. BASIC is a high level

programing languages. It was

developed by john kemeny and Thomas Kurtz in 1963 in USA. It


was developed for beginners and student to teach the
fundamental concepts of programming. It was very easy to learn
and to write computer programs.

Non- Procedural languages


In non procedural programming language, the order of
program instructions is not important. The importance is given only to what
is to be done. With a non-procedural language, the user(programmer)
writes English like instructions to reyrieve databases. These languages are
easier to use than procedural languages. The most important nonprocedural languages and tools are discussed below.

1. RPG

11

RPG stands for Report program generator. This language was


developed by IBM in early 1960 s.it is used to generate business
reports. It is mostly used with IBM midrange computers such
AS/400.

2. SQL

SQL stands for structured Query Language. SQL was developed


by IBM. It is very popular database access language. It is
specially
The

used to access and to manipulate the data of databases.


word query represents data this language is used to make
queries (or inquiries) to perfume various operations on data of
database. However ,SQL can also be used to create table, add
data, delete data ,update data of database tables etc.

Object oriented programming language


The object oriented

programming concept was introduced in

the late 1960s but now it has become the most popular approach to develop
software. In object oriented, programming, a program is designed by using
objects. In object- oriented approach, a whole system is divided into a set of
objects. It is an easy and flexible approach for designing and organizing the
program. Now-a-days, most popular and commonly used object

oriented

programming (OOP) languages are C++ and JAVA.

Low-level languages

High-level languages
12

1
2
3
4

It
It
It
It

Program written in low- level language


is faster in execution.
Deep knowledge of hardware is
required to learn and use low-level
language.
There are few programmers that can
write programs in low- level language.
It is difficult to trace out errors in the
programs
written
in
low-level
languages.
Low-level languages are not commonly
used. `
The programs statement written lowlevel language is very lengthy.

7
8

9
1
0

is close to machine language.


is difficult to learn and use.
is machine dependent.
does not provide built-in functions.

It is close to human language.


It is easy to learn and use.
It is not machine dependent.
It provide large number of build- in
functions.
Program written in high-level language is
slower in execution.
No deep knowledge of hardware is
required to learn and use high- level
language.
There are many programmer in can write
program in high- level language.
It is easy to trace out errors in the
program written in high- level language.
High- level languages are commonly
used.
The programs statement written highlevel language is very short.

LANGUAGE PROCESSORES
A computer understands instructions in machine code ( i.e. in
the form of 0s and 1s). It is difficult to write computer program directly in
machine code. Today, mostly the program are written in high-level languages
i.e. C, C++, Java, BASIC, PASCAL, etc.
A program written in any high -level programming language ( or
written in assembly language) is called the Source Program.

The source

code cannot be executed directly by the computer. The source program must
be converted into machine code before running it on the computer.
The special translator system software that is used to translate
the program written in high-level language ( or assembly language ) into
machine code is called language translator or language processor.
Every language ha its own language translator program.

Types of Language Processors.

13

The language processors are divided into three types. These are
compiler, interpreter, and assembler.

1. Compiler.
The language translator program that translate the complete
source program into machine code as a whole is called compiler.
The C and C++ compliers are best examples of compilers.
The program translated into machine code is called the object
program. The source code is translated into

object

code

successfully if it is free of errors. If there are any errors in the


source

code, the compiler specifies the errors at the end of

compilation. The errors must be removed before the compiler


can successfully compile the source code. The object program
can be executed a number of times without

translating

it

again.
2. Interpreter
The language translator program that translates the source
code

into machine code statement by statement is called interpreter.


It translates on statement of source program into machine code
and executes

it

immediately before

translating the next

statement. If there is an error in the statement, the interpreter


terminates its translating process at that statement. It also
displays an error message. The GWBASIC is an example of an
interpreter program.
The main advantage of interpreter is that it makes easier to
detect

and correct errors in the source program.


The main disadvantages of interpreter are:
14

It is a time consuming

process of translating and executing

statements one by one.


Each time the program is run, the source code is translated again. For
this purpose you must have a translator program ( Interpreter)
permanently in your computer
3. Assembler:
The language translator program that translates the program
written in assembly language into machine code is

called

assembler
An assembler performs the translation process in similar way as
compiler. But assembler is the translator program for assembly
language (a low-level programming language), while a compiler
is

the translator program for high-level programming language.

DIFFERENCE BETWEEN COMPILER & INTERPRETER.


The main differences between compiler and interpreter are as follows:Compiler
1
2
3
4

5
6

It translates source code into object


code as a whole.
It creates an object file.
Program execution is very fast
Translator program is not required to
translate the program each time you
want to run the program
It is not easier to correct the errors in
the source code.
Most of the high-level programming
languages have compiler program.

Interpreter
It translate the source code into machine
code statement -by-statement.
It does not create and object file.
Program execution is slow.
Translator program is required to
translate the program each time you want
to run the program.
It is easier to correct the errors in the
source code.
A few high-level programming languages
have interpreter program.

15

You might also like