0% found this document useful (0 votes)
3 views4 pages

Form 1 Programming Notes

Uploaded by

Bryton Birdas
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Form 1 Programming Notes

Uploaded by

Bryton Birdas
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Form 1 notes

PROGRAMMING CONCEPTS
Definition of terms:
- Program: a set of detailed and unambiguous instructions that instructs a computer to
perform a specific task, for example, to add a set of numbers.
- Programming: A process of designing, coding and testing computer programs
- Programmer: A person who specialises in designing, coding and testing computer
programs
- Problem: any question or matter involving difficulty or uncertainty and is proposed for
solution.
PROGRAMMING LANGUAGES
A programming language is a set of symbols in computer language that are used in coding
computer programs. Programming languages are of the following types:
1. Low Level Languages (LLL): These are programming languages used to write programs
in machine code, that is in zeros and ones or in mnemonic codes. Low level language is in
two forms: Machine Language and Assembly Language.
a. Machine code (language) is the language used to write programs in binary form (zeros
and ones). Machine language has the following advantages:
(i) Programs run faster since they are already in computer language. There is no need for
conversion as programs are in machine language. (ii) Programs occupy very small disc
storage space by storing just 1s and 0s.
Disadvantages of Machine language:
They are very difficult to learn. They are difficult to understand. Very difficult to use and
takes too long to find an error in a program. It takes too long too develop working programs.
They are machine dependent (they can only work on type of computer designed for and not
work on other computers)
b. Assembly Language: These are programming languages that use mneumonic codes in
coding programs. Mneumonic codes are abbreviations used in coding assembly language
programs, for example, LDA for Load, ADD for Addition, etc. Mneumonic codes are very
close to machine code, hence are low level language assembly language codes
Advantages of Assembly language:
One assembly language instruction corresponds to one machine code instruction and
therefore translation is easier and faster. Programs run faster since they are close to machine
code. They occupy very small disk storage space hence are economical to use. Easier for a
programmer to use than machine language.
Disadvantages of Assembly Language
They are very difficult to learn. They are very difficult to understand. Takes too long to
develop working programs. They can be machine dependent.
NB. Assemblers: These are programs used to convert assembly language instructions into
machine language. Other uses of assemblers include:
They generate machine code that is equivalent to assembly language. They are used to check
the validity of instructions, that is, checking for syntax errors in an instruction. They also
assign memory locations to variables.
2. High Level Languages (HLL): These are programming languages that use English-like
statements in coding programs, for example COBOL, Pascal, BASIC, etc. There are so many
high level languages because each language is designed for a specific problem to be solved in
our daily lives. For example BASIC was designed for learning purposes, COBOL for
business applications, FORTRAN for scientific purposes, etc. Below is an example of a
BASIC program that accepts two numbers entered through the keyboard, adds them and
display the result on the screen:
INPUT ―ENTER FIRST NUMBER.‖, A
INPUT ―ENTER SECOND NUMBER.‖, B
SUM = A + B
PRINT SUM
END
Programs written in High Level Language are first converted to machine code before
running.
Advantages of High Level Languages:
They are easier to understand since they are written in English-like statements which are
more readable. They are easier to learn. It is easier to work with, that is to correct errors and
to test programs. They are problem oriented and therefore can be used on any computer (not
machine dependent)
Disadvantages of HLL
Takes long to run since they need to be first converted to machine code. They occupy a lot of
disk storage space as compared to low level languages.
Factors to consider when choosing a programming language
Nature of the application. Availability of needed facilities in the programming language for
system implementation. Availability of compatible hardware. Availability of expertise of the
programmers.

TRANSLATORS
These are programs used to convert High level Language programs into machine code, and
are in two types, which are interpreters and compilers, which are further explained below:
Interpreters
These are programs that convert and run one instruction of a program at a time until the end
of the program, e.g. the BASIC interpreter. They do not produce the machine code version of
a program; hence conversion is repeated when you run the program again.
Functions of Interpreters
They check syntax error in a program statement. They translate an instruction into machine
language and run it. Allocates storage space to variables.
Advantages of interpreters
It is easy to find and correct syntax errors in interpreted programs. It is very fast to run
programs for the first time. It is very fast to run small programs.
Disadvantages of interpreters
They are very slow in running very large programs. They do not produce an object code of a
source code and hence difficult to use.
Compilers
These are programs that convert a high level language program into its machine code
equivalent at one go and then run it, e.g. the COBOL compiler. Once compiled, the program
no longer needs conversion since the machine code version is the one that will be run, until
some changes are made to the program code.
Functions of Compilers
They check syntax errors in program statements. They allocate storage space to variables.
Translate the whole program into machine code at one go. Run an object code of the
program. Produces a program listing which indicates position of errors in a program.
Advantages of Compilers
Compiled programs runs faster since the object code is run. Compilers indicate the line
numbers with syntax errors and therefore assist programmers in debugging programs. They
are appropriate even for very large programs.
Disadvantages of Compilers
Slower than interpreters for running programs for the first time. They can cause the computer
to crash. Difficult to find errors in compiled program.
*NB: Source Code refers to the program written in English-like statements (High Level
Language) by the programmer.
Object Code refers to a machine code version of a source code. All programs written in
source code must be converted to object code for the computer to understand them. ‘O’ Level
C

Difference between High Level Languages Low Level Language


and Low Level Languages High Level
Language
1 Written in English like Written in 1s and 0s (machine
statements code) or in mneumonic codes.
2 Easier to work with Difficult to work with
3 Easier to understand Difficult to understand
4 Are problem oriented and can Machine oriented
be used on any computer
5 Slower in execution since they Faster in execution since they
need to be first converted to are in machine code already.
machine code before running
6 Occupy large disk storage Occupy small disk storage
space on the computer space on the computer
7 They are machine independent They are machine dependent

You might also like