Notes-1
Notes-1
o Prog. Envt. is the envt, in which programs are created & tested.
o It is much closer to O.S. than the design of a programming language.
o Prog. Envt. consists of a set of support tools & a command language
(instruction Set) for invoking the tools.
o Each support tool is another program that may be used by programmer as an
aid during >1 stages of program-creation.
Tools example : - Editors, debuggers, verifiers, compilers, test data generators & pretty
printers etc.
Types of Software
Program: A sequence of instructions for the computer is called a program. The data
that are manipulated by the program create the database.
1. System software-It is the software used to manage and control the hardware
components and which allow interaction between the hardware and the other types
of software. The most obvious type of system software is operating system and
device drivers.
Utility software-It is software such as anti-virus software, firewalls, disk
defragmenters and so on.
which helps to maintain and protect the computer system but does not directly
interface with the hardware.
2. Applications software (also known as 'apps') are designed to allow the user of the
system to complete a specific task(application). They include programs such as web
browsers, MS office, games, media players and so on.
COMPUTER LANGUAGES
Languages are a means of communication. Normally people interact with each other
through a language. On the same pattern, communication with computers is carried out
through a language. This language is understood both by the user and the machine.
Just as every language like English, Hindi has its own grammatical rules; every computer
language is also bounded by rules known as syntax of that language. The user is bound by
that syntax while communicating with the computer system.
Computer languages are broadly classified as:
Low Level Language: The term low level highlights the fact that it is closer to a language
which the machine understands
The low level languages are classified as:
Machine Language: This is the language (in the form of 0‘s and 1‘s, called binary numbers)
understood directly by the computer. It is machine dependent. It is difficult to learn and even
more difficult to write programs.
Assembly Language: This is the language where the machine codes comprising of 0‘sand
1‘s are substituted by symbolic codes (called mnemonics) to improve their understanding.
It
is the first step to improve programming structure. Assembly language programming is
simpler and less time consuming than machine level programming, it is easier to locate and
correct errors in assembly language than in machine language programs. It is also machine
dependent. Programmers must have knowledge of the machine on which the program will
run.
High Level Language: Low level language requires extensive knowledge of the hardware
since it is machine dependent. To overcome this limitation, high level language has been
evolved which uses normal English, which is easy to understand to solve any problem. High
level languages are computer independent and programming becomes quite easy and
simple. Various high level languages are given below:
C: Structured Programming Language used for all purpose such as scientific application,
commercial application, developing games etc.
Algorithm:
The Fundamental knowledge needed to solve problems using a computer is the notion of
an algorithm.
“An Algorithm is a precise specification of a seq. of instructions (tells what task is
to be executed) to be carried out in order solve a given problem”.
FLOWCHARTS
Flocharting Symbols
Start
Read(i/p)
C
F = C x 1.8
F = F + 32
(Display)Write temp
in F
Stop
Example 2: Design Algo. for choosing the largest of 3 given positive integers.
Input : Three integers :– A, B, C. o/p : Largest no. among A, B, C.
Example 3. Design Algo for finding the sum of given N nos. & display the result.
I/p: N nos. entered (one by one) by keyboard. O/p: sum of N elements (entered by
keyboard).
1. start
2. obtain the value N(total nos. to be entered)
3. Initialize variable sum & counter to 0.
4. Read the no. as num
5. Add this num to sum and update sum.
6. Increment the value of the counter by one
7. Continue steps 4 to 6 till counter < = N.
8. Print the sum value.
9. Stop
Q: Draw flowchart to find roots of quadratic equation.
prog:
• Preprocessing
• Assembling & Compiling
• Linking & Loading
Assembler: A computer will not understand any program written in a language, other than
its machine language. The programs written in other languages must be translated into the
machine language. Such translation is performed with the help of software. A program which
translates an assembly language program into a machine language program is called an
assembler. If an assembler which runs on a computer and produces the machine codes for
the same computer then it is called self assembler or resident assembler. If an assembler that
runs on a computer and produces the machine codes for other computer then it is called
Cross Assembler.
Assemblers are further divided into two types: One Pass Assembler and Two
Pass Assembler. One pass assembler is the assembler which assigns the memory addresses
to the variables and translates the source code into machine code in the first pass
simultaneously. A Two Pass Assembler is the assembler which reads the source code twice.
In the first pass, it reads all the variables and assigns them memory addresses. In the second
pass, it reads the source code and translates the code into object code.
Compiler: It is a program which translates a high level language program into a machine
language program. A compiler is more intelligent than an assembler. It checks all kinds of
limits, ranges, errors etc. But its program run time is more and occupies a larger part of the
memory. It has slow speed. Because a compiler goes through the entire program and then
translates the entire program into machine codes. If a compiler runs on a computer and
produces the machine codes for the same computer then it is known as a self compiler or
resident compiler. On the other hand, if a compiler runs on a computer and produces the
machine codes for other computer then it is known as a cross compiler.
Interpreter: An interpreter is a program which translates statements of a program into
machine code. It translates only one statement of the program at a time. It reads only one
statement of program, translates it and executes it. Then it reads the next statement of the
program again translates it and executes it. In this way it proceeds further till all the
statements are translated and executed. On the other hand, a compiler goes through the
entire program and then translates the entire program into machine codes. A compiler is 5
to 25 times faster than an interpreter.
By the compiler, the machine codes are saved permanently for future
reference. On the other hand, the machine codes produced by interpreter are not saved. An
interpreter is a small program as compared to compiler. It occupies less memory space, so it
can be used in a smaller system which has limited memory space.
Linker: In high level languages, some built in header files or libraries are stored. These
libraries are predefined and these contain basic functions which are essential for executing
the program. These functions are linked to the libraries by a program called Linker. If linker
does not find a library of a function then it informs to compiler and then compiler generates
an error. The compiler automatically invokes the linker as the last step in compiling a
program.
Not built in libraries, it also links the user defined functions to the user defined
libraries. Usually a longer program is divided into smaller subprograms called modules. And
these modules must be combined to execute the program. The process of combining the
modules is done by the linker.
Loader: Loader is a program that loads machine codes of a program into the system
memory. In Computing, a loader is the part of an Operating System that is responsible for
loading programs. It is one of the essential stages in the process of starting a program.
Because it places programs into memory and prepares them for execution. Loading a
program involves reading the contents of executable file into memory. Once loading is
complete, the operating system starts the program by passing control to the loaded program
code. All operating systems that support program loading have loaders. In many operating
systems the loader is permanently resident in memory.
Difference between Compiler and Interpreter:
Interpreter Compiler
Scans the entire program and translates it as
Translates program one statement at a time.
a whole into machine code.
It takes less amount of time to analyze the It takes large amount of time to analyze the
source code but the overall execution time is source code but the overall execution time is
slower. comparatively faster.
Generates intermediate object code which
No intermediate object code is generated,
further requires linking, hence requires more
hence are memory efficient.
memory.
Continues translating the program until the It generates the error message only after
first error is met, in which case it stops. scanning the whole program. Hence
Hence debugging is easy. debugging is comparatively hard.
Ex-Programming language like Python, Ex-Programming language like C, C++ use
Ruby use interpreters. compilers.