CHAPTER FIVE - PROGRAMMING5.1.1.1 State the definition of program.A
computer program is a series of organised instructions that directs a computer
to perform tasks. Without programs, computers are
useless.
5.1.1.2 State the definition of programming
language.A programming language is a set of words, symbols and codes
that enables humans to communicate with computers. It is a language used for
writing computer programs, that direct a computer to perform computation and to
organise the flow of control between mechanical
devices.
5.1.2.1 Identify the generations of low-level programming
languages with examples.A low-level programming language is a
programming language that provides little or no abstraction from computer’s
microprocessor.
FIRST GENERATION OF PROGRAMMING LANGUAGEThe first
generation of programming language, or 1GL, is machine language. Machine
language is a set of instructions and data that a computer's central processing
unit can execute directly. Machine language statements are written in binary
code, and each statement corresponds to one machine action.
SECOND
GENERATION PROGRAMMING LANGUAGEThe second generation programming
language, or 2GL, is assembly language. Assembly language is the human-readable
notation for the machine language used to control specific computer operations.
An assembly language programmer writes instructions using symbolic instruction
codes that are meaningful abbreviations or mnemonics. An assembler is a program
that translates assembly language into machine language. Since assembly language
consist of human-readable abbreviations, the assembler must first convert
assembly language into machine-readable language before the computer can readily
understand its instructions.
5.1.2.2 Identify the generations of
high-level programming languages with examples.A high-level programming
language is a programming language that is more abstract, easier to use, and
more portable across platforms.
THIRD GENERATION PROGRAMMING
LANGUAGEThe third generation of programming language, 3GL, or procedural
language uses a series of English-like words, that are closer to human language,
to write instructions.
High-level programming languages make complex
programming simpler and easier to read, write and maintain.Programs written in a
high-level programming language must be translated into machine language by a
compiler or interpreter.
PASCAL, FORTRAN, BASIC, COBOL, C and C++ are
examples of third generation programming languages.
FOURTH GENERATION
PROGRAMMING LANGUAGEThe fourth generation programming language or
non-procedural language, often abbreviated as 4GL, enables users to access data
in a database.
CHAPTER FIVE - PROGRAMMING
A
very high-level programming language is often referred to as goal-oriented
programming language because it is usually limited to a very specific
application and it might use syntax that is never used in other programming
languages.
SQL, NOMAD and FOCUS are examples of fourth generation
programming languages.
FIFTH GENERATION PROGRAMMING LANGUAGEThe
fifth generation programming language or visual programming language, is also
known as natural language. Provides a visual or graphical interface, called a
visual programming environment, for creating source codes.
Fifth
generation programming allows people to interact with computers without needing
any specialised knowledge. People can talk to computers and the voice
recognition systems can convert spoken sounds into written words, but these
systems do not understand what they are writing; they simply take
dictation.
Prolog and Mercury are the best known fifth-generation
languages.
5.1.3.1 Define structured approach in
programming.
STRUCTURED PROGRAMMING EDUCATIONStructured
programming often uses a top-down design model where developers map out the
overall program structure into separate subsections from top to
bottom.
In the top-down design model, programs are drawn as rectangles. A
top-down design means that the whole program is broken down into smaller
sections that are known as modules. A program may have a module or several
modules.
Structured programming is beneficial for organising and coding
computer programs which employ a hierarchy of modules. This means that control
is passed downwards only through the hierarchy.
Examples of structured
programming languages include Ada, Pascal and
Fortran.
5.1.3.2 Define object-oriented approach in
programming.The object-oriented approach refers to a special type of
programming approach that combines data with functions to create objects. In an
object-oriented program, the object have relationships with one another. One of
the earliest OOP languages is Smalltalk. Java, Visual Basic and C++ are examples
of popular OOP languages.
5.1.3.3 Differentiate between structured
approach and object-oriented approach in programming. Structured programming
often uses a top-down design model. The object-oriented programming approach
uses objects.
5.1.4.1 Describe the translation method of
programming using assembler, interpreter and
compiler.ASSEMBLERAn assembler is a computer program for
translating assembly language — essentially, a mnemonic representation of
machine language — into machine language.
For example in intel 80836, the
assembly language for the ’no operation’ command is NOP and its machine code
representation is 10010000. Example of assemblers are MACRO-80 Assembler and
Microsoft MASM.
INTERPRETERInterpreter is used to interpret and
execute program directly from its source without compiling it first. The source
code of an interpreted language is interpreted and executed in real time when
the user execute it.
The interpreter will read each codes converts it to
machine code and executes it line by line until the end of the program. Examples
of interpreter-based language are BASIC, Logo and
Smalltalk.
COMPILERThe source code (in text format) will be
converted into machine code which is a file consisting of binary machine code
that can be executed on a computer. If the compiler encounters any errors, it
records them in the program-listing file.
When a user wants to run the
program, the object program is loaded into the memory of the computer and the
program instructions begin executing. A compiled code generally runs faster than
programs based on interpreted language. Several programming languages like C++,
Pascal and COBOL used compilers as their
translators.
5.1.5.1 Differentiate between constants and
variables.Constants VariablesCharacteristics
Value is not
changeable during the course of the program.
Value can be changed anytime
during the course of the program.
Usage
Use constant when you want
to declare someting that won’t be changed midway in your program
execution.
Use variable to store data that may or will change during the
running of the program.
5.1.5.2 Differentiate between the data
types: Boolean, integer, double, string and date.IntegerInteger
data type contains any whole number value that does not have any fractional
part.
DoubleAny number value that may and could contain a
fractional part.
StringAny value that contains a sequence of
characters.
BooleanBoolean type consists either a True or False
value. Programmers usually use it to store
status.
Based on that, the programmer will design a
flow chart that represents the needs of the client