Linkers & Loaders
Computer programs are usually developed in Modules or Subroutines (i.e., program segments meant to carry out the specific relevant tasks). During program translation, these modules are translated separately into their object (machine) code equivalents.
The Linker is a utility software that accepts the separately translated program modules as its input, and logically combines them into one logical module, known as the Load Module that has got all the required bits and pieces for the translated program to be obeyed by the computer hardware. The Loader is a utility program that transfers the load module (i.e. the linker output) into the computer memory, ready for it to be executed by the computer hardware.
Syntax
Each programming language has a special sequence or order of writing characters.
The term Syntax refers to the grammatical rules, which govern how words, symbols, expressions and statements may be formed & combined. Semantics
These are rules, which govern the meaning of syntax. They dictate what happens (takes place) when a program is run or executed.
Review Questions.
0 Comments
DEFINITION AND DEVELOPMENT OF ALGORITHM E.G. PSEUDO-CODE, FLOW CHART
Definition and development of Algorithm e.g.
To design a good pseudocode, proceed as follows
FLOWCHART
Flowcharts are used by programmers to:
​Description of terms: assembler, compiler, interpreter, source program, object program18/11/2021
LANGUAGE TRANSLATORS
A computer uses & stores information in binary form, and therefore, it cannot understand programs written in either high-level or low-level languages. This means that, any program code written in Assembly language or high-level language must be translated into Machine language, before the computer can recognize & run these programs.
A Translator is special system software used to convert the Source codes (program statements written in any of the computer programming languages) to their Object codes (computer language equivalents). The Translators reside in the main memory of the computer, and use the program code of the high-level or Assembly language as input data, changes the codes, and gives the output program in machine-readable code. In addition, translators check for & identify some types of errors (e.g., Syntax/grammatical errors) that may be present in the program being translated. They will produce error messages if there is a mistake in the code. Each language needs its own translator. Generally, there are 3 types of language translators:
Note. Interpreters & Compilers translate source programs written in high-level languages to their machine language equivalents.
Assembler
An assembler translates programs written in Assembly language into machine language that the computer can understand and execute.
Functions of an Assembler.
Note. The Assembler cannot detect Logic errors. The programmer knows of these errors only when the program is run & the results produced are incorrect (not what the programmer expected). The programmer must therefore, go through the program & try to discover why an incorrect result was being produced. Compiler
A compiler translates the entire/whole source program into object code at once, and then executes it in machine language code. These machine code instructions can then be run on the computer to perform the particular task as specified in the high-level program.
The process of translating a program written in a high-level source language into machine language using a compiler is called Compilation. For a given machine, each language requires its own Compiler. E.g., for a computer to be able translate a program written in FORTRAN into machine language; the program must pass through the FORTRAN compiler (which must ‘know’ FORTRAN as well as the Machine language of the computer). The object code file can be made into a fully executable program by carrying out a Linking process, which joins the object code to all the other files that are needed for the execution of the program. After the linking process, an executable file with an .EXE extension is generated. This file is stored on a storage media. Points to note.
Functions of a compiler.
A Compiler performs the following tasks during the compilation process:
Differences between Compilers and InterpretersInterpreter
An interpreter translates a source program word by word or line by line. This allows the CPU to execute one line at a time.
The Interpreter takes one line of the source program, translates it into a machine instruction, and then it is immediately executed by the CPU. It then takes the next instruction, translates it into a machine instruction, and then the CPU executes it, and so on. The translated line is not stored in the computer memory. Therefore, every time the program is needed for execution, it has to be translated. Source Program
Source program (source code)
The term Source program refers to program statements that the programmer enters in the program editor window, and which have not yet been translated into machine-readable form. Source code is the code understood by the programmer, and is usually written in high-level language or Assembly language. Object Code
Object code (object program).
The term Object code refers to the program code that is in machine-readable (binary) form. This is the code/language the computer can understand, and is produced by a Compiler or Assembler after translating the Source program into a form that can be readily loaded into the computer.
Advantages and disadvantages of low and high level languages.
Machine language
Assembly language
High-level languages
Levels of programming languages
LEVELS OF PROGRAMMING LANGUAGES
There are many programming languages. The languages are classified into 2 major categories:
LOW-LEVEL LANGUAGES
These are the basic programming languages, which can easily be understood by the computer directly, or which require little effort to be translated into computer understandable form.
They include:
Features of low-level languages
Machine languages (1st Generation languages)
Machine language is written using machine codes (binary digits) that consist of 0’s & 1’s.
The computer can readily understand Machine code (language) instructions without any translation. A programmer is required to write his program in strings of 0’s & 1’s, calculate & allocate the core memory locations for his data and/or instructions. Different CPU’s have different machine codes, e.g., codes written for the Intel Pentium processors may differ from those written for Motorola or Cyrix processors. Therefore, before interpreting the meaning of a particular code, a programmer must know for which CPU the program was written. A machine code instruction is made up of 2 main parts;
Note. The computer can only execute instructions which are written in machine language. This is because; it is the only language which the computer can understand. Therefore, any program written in any other programming language must first be translated into machine language (binary digits) before the computer can understand. Assembly language (2nd Generation Languages).
Assembly languages were developed in order to speed up programming (i.e., to overcome the difficulties of understanding and using machine languages).
The vocabulary of Assembly languages is close to that of machine language, and their instructions are symbolic representations of the machine language instructions.
To write program statements in Assembly language, the programmer uses a set of symbolic operation codes called Mnemonic codes. The code could be a 2 or 3 shortened letter word that will cause the computer to perform specific operation. E.g., MOV – move, ADD - addition, SUB – subtraction, RD - read. Example; RD PAT, 15 (read the value 15 stored in the processor register named PAT) SUB PAT, 10 (subtract 10 from the value in register PAT) A program written in an Assembly language cannot be executed/obeyed by the computer hardware directly. To enable the CPU understand Assembly language instructions, an Assembler (which is stored in a ROM) is used to convert them into Machine language. The Assembler accepts the source codes written in an Assembly language as its input, and translates them into their corresponding computer language (machine code/ object code) equivalent. Comments are incorporated into the program statements to make them easier to be understood by the human programmers. Assembly languages are machine-dependent. Therefore, a program written in the Assembly language for a particular computer cannot run on another make of computer. Advantages of Low-level languages
Disadvantages of Low-level languages
Very few computer programs are actually written in machine or Assembly language because of the following reasons;
HIGH-LEVEL PROGRAMMING LANGUAGES
High-level languages were developed to solve (overcome) the problems encountered in low-level programming languages.
The grammar of High-level languages is very close to the vocabulary of the natural languages used by human beings. Hence; they can be read and understood easily even by people who are not experts in programming. Most high-level languages are general-purpose & problem-oriented. They allow the programmer to concentrate on the functional details of a program rather than the details of the hardware on which the program will run. High-level language programs are machine-independent, (i.e., they do not depend on a particular machine, and are able to run in any family of computers provided the relevant translator software is installed). Programs written in a high-level language cannot be obeyed by the computer hardware directly. Therefore, the source codes must be translated into their corresponding machine language equivalent. The translation process is carried out by a high-level language software translator such as a Compiler or an Interpreter. Features of high-level programming languages.
Purpose of High-level languages.
Advantages of High-level languages.
Disadvantages of using High-level languages
TYPES OF HIGH-LEVEL LANGUAGES
High-level languages are classified into five different groups:
The various types of high-level languages differ in:
STRUCTURED LANGUAGES
A structured (procedural) language allows a large program to be broken into smaller sub-programs called modules, each performing a particular (single) task. This technique of program design is referred to as structured programming.
Structured programming also makes use of a few simple control structures in problem solving. The 3 basic control structures are:
Advantages of structured programming.
Examples of Third generation programming languages include:
FOURTH GENERATION LANGUAGES (4GL’S).
4GLs make programming even easier than the 3GLs because; they present the programmer with more programming tools, such as command buttons, forms, textboxes etc. The programmer simply selects graphical objects called controls on the screen, and then uses them to create designs on a form by dragging a mouse pointer.
The languages also use application generators (which in the background) to generate the necessary program codes; hence, the programmer is freed from the tedious work of writing the code. 4GLs are used to enquire & access the data stored in database systems; hence, they are described as the Query languages. Purpose of fourth generation languages.
The 4GL’s were designed to meet the following objectives: -
Examples of 4GLs are:
Advantages of fourth generation languages.
FIFTH GENERATION LANGUAGES (5GL’S).The 5GL’s are designed to make a computer solve a problem by portraying human-like intelligence. The languages are able to make a computer solve a problem for the programmer; hence, he/she does not spend a lot of time in coming up with the solution. The programmer only thinks about what problem needs to be solved and what conditions need to be met without worrying about how to implement an algorithm to solve the problem. 5GLs are mostly used in artificial intelligence. Examples of 5GLs are:
OBJECT-ORIENTED PROGRAMMING LANGUAGES (OOPs)
Examples of Object-oriented programming languages are: -
JAVA
WEB SCRIPTING LANGUAGES.
Comparison of Programming languages.
Factors to consider when choosing a Programming language.
The following factors should be considered when choosing a Programming language to use in solving a problem:
Review Questions
Definition of ProgrammingComputer Program:
A computer program is a set of coded instructions given to the computer, and represents a logical solution to a problem. It directs a computer in performing various operations/tasks on the data supplied to it.
Computer programs may be written by the hardware manufacturers, Software houses, or a programmer to solve user problems on the computer.
Programming:
Programming is the process of designing a set of instructions (computer programs) which can be used to perform a particular task or solve a specific problem.
It involves use of special characters, signs and symbols found in a particular programming language to create computer instructions. The programming process is quite extensive. It includes analyzing of an application, designing of a solution, coding for the processor, testing to produce an operating program, and development of other procedures to make the system function. The program created must specify in detail the logical steps to be taken & the method of processing the data input into the computer in order to carry out the specified task.
A computer program performs the following:
Programming Languages:
A programming language is a set of symbols (a language) which a computer programmer uses to solve a given problem using a computer.
The computer must be able to translate these instructions into machine-readable form when arranged in a particular sequence or order.
(a) List and describe four strategies for converting from an old system to a new system. (4mks)
(b) (i) Distinguish between private data and confidential data (2mks)
(ii) What can be done to stop illegal access to a computer laboratory by unauthorized people (3mks)
(c) (i) List four areas that would be considered in the requirement specification. (4mks)
(ii) Name any two areas covered in feasibility report during system analysis and design. (2mks)
A computer diskette in drive A has folders for MEMOS for an administrator. Each of these folders is labelled according to the relevant months. The secretary created the folders for each month’s memo for each of access. Study the table below(a) Assuming that the secondary was working from the diskette, draw the corresponding tree structure (6mks)(b) (i) The secretary wanted to create a folder to store a memo in Fraud folder. State the path for that folder. (2mks)
A:/MEMO2/Fraud
(ii) Suggest how the secretary can ensure that the work in that diskette is not spoilt. (1mk)
(iii) The content of the file is not viewed by any other person apart from her. (1mk)
use of password
(c) (i) List any two devices under the control of the operating system. (2mks)
(ii) Explain how each one of these devices are controlled by the OS - Operating System
Input/output devices and ports
In most cases, the operating system controls all data input and information output tasks. Because most input/output devices are slower than the processor, the operating system has to control the flow of data from the time of input to the time the user receives it as information. It ensures that the right data reaches the processor at the right time. The operating system also defines the various input/output ports found on the computer e.g. printer port.
The processor
The processor is a scarce resource. It executes tasks called processes. At any one time several tasks may require processing hence creating competition. The operating system arranges the tasks according to priority and has the ability to stop a particular task to allow the processor to service another one.
Main memory(RAM)
At any one given time so many tasks may require the memory so that they can be accessed and processed by the computer.However,because memory is also a scarce resource,the operating system determines which task will remain in memory awaiting for execution and which one will be sent back to secondary storage to wait. Because the operating system is large and very important, it is usually installed on the hard disk but must be loaded to RAM during the booting process. Not all the operating system can fit in RAM so a small special part that contains the most necessary commands and procedures called the kernel is the one that is loaded.
Secondary storage devices
The operating system manages the storage and retrieval of data on secondary storage devices. It also utilizes the free space on hard disks to enhance the performance of the computer by temporarily holding tasks on it that were in RAM ready for processing but have to wait for sometime.
Communication devices and ports
Communication in this case refers to how the various devices and programs in and out of the computer system send and receive messages from one another and from the processor. The operating system controls the overall communication process between various tasks and computers. External communication can be achieved by connecting an external device to a communication port using a communication medium like cables or even wireless communication.
The information below is maintained by the sales lady at the school canteen. Study it and answer the questions that follow.(a) Describe the basic data types used in this spreadsheet (4mks)
(b) Provide a single formula that would be used to
|
Categories
All
Archives
December 2024
|