Notes, Exercises, Videos, Tests and Things to Remember on Programming languages
Please scroll down to get to the study materials.
Things to remember
A program is a set of sequenced instructions which commands the computer to perform a particular operation or a special task. It is written in a programming language which is then translated into machine code by a language processor so that the computer can execute its tasks.
The thorough understanding regarding the entire process of the development of programs is called programming concept. It includes the overall understanding and applications of different computer programming languages, compiler, interpreter, control structures, program design tools, syntax, semantic, programming techniques and different stages involved in a program development.
When we write a program, we have to follow the grammatical rules as to write the statement in a program. The program is finally created when such statements are written in chronological order and starts performing tasks. Simply said, programming is a way of creating a sequence of instructions to enable the computer to do something.
Language is a means of communication among humans. Even animals and every other living being need language. One simply cannot communicate with others without language. Likewise, a computer also needs a language so that it can communicate with the users, which is called a programming language.
Fig: Programming Language Source: www.devsaran.com
A programming language is a language used by computers by which they understand to do what the program users want. It is a set of codes and written symbols that provide the platform for instructing computers to perform some specified tasks. The process of writing a program is known as coding or programming and the person who writes the program codes is called a programmer.
On the basis of nature, programming languages are divided into 2 categories. They are:
General purpose programming languages: for solving almost all types of problems.
Specific purpose programming languages: for solving problems of specific nature.
Whereas, generally, programming languages are divided into 2 categories. They are:
1) Low-Level Languages (LLL)
Low-level language can be divided into two types:
Machine language (1GL)
Assembly language (2GL)
I. Machine language: The language that is called the language of CPU and is written in binary code (composed of 0 and 1) is called Machine language. In this language, a computer can understand every instructions given only in the form of 0 and 1. All the valid computer operations are performed in terms of binary operation.
The advantages of Machine language are:
The program written in machine language does not need any translation.
Although, it is very difficult to write a program in machine language, the program written in machine language runs faster than any other program.
The disadvantages of Machine language are:
Machine language is very machine dependent. The program written for one processor cannot be run in another processor i.e. a machine code of Intel processor doesn’t work for Motorola processor.
Machine language has to be written in the form of 1 and 0. So, it is quite stressful to do programs in machine language.
Chances of error are high while writing a program in machine language.
It is very difficult to debug the program written in machine language.
It is very time-consuming and difficult to solve complex problems under this language.
II. Assembly language: The language in which a program is written in shortcodes like ADD, MUL or SUB instead of writing instruction in a binary number (0 and 1) is called Assembly language. An assembler converts the assembly language to the machine language to make it understandable by computer hardware because a computer can understand the instruction written only in binary form. Assembly language is not a user-friendly language. This language is also very processor dependent language. A program written for one processor does not work in another processor. Computer viruses are mostly written in this language.
The general of its instructions are shown below:
Add B to A
Fig: Assembly language instruction format
The advantages of Assembly language are:
Assembly language is easier to understand as compared to machine language.
Unlike machine language, it is easier to modify.
Chances of error are less than machine language.
In assembly language, program execution time is faster than a program written in any high-level languages.
As compared to machine language, assembly language is of a more standard form of language.
We do not need to take care of storage location of data and instruction while writing a program in assembly language.
This language is more efficient in solving hardware interfacing problems.
Some of its disadvantages/ limitations are:
It is a processor (Machine Dependent Language).
Since, it is a machine dependent language, it requires the knowledge of hardware while writing a program.
There is one to one correspondence between the assembly language and machine language instruction.
Written in this language, a program can be very lengthy and complex for programming.
Execution of program is slower and less efficient than machine language.
(Shrestha & Rimal, 2015)
2) High-Level Languages (HLL)
The languages which are quite similar to written English and are therefore very easier to use in compared to machine language and assembly language are called High-level languages. Programs written in high-level languages are translated into machine language by a language translator called a compiler or an interpreter. The 1st high-level language was developed by John Backus, in IBM Laboratory, in 1956. Further developed during the 60s, high-level languages were developed to make the programming easier and to overcome the limitations of low-level languages. High-level languages are of 3 types. They are:
Procedural oriented language (3GL)
Problem-oriented (4th generation language (4GL))
Natural (5th generation language (5GL))
Procedural oriented language: Procedural Oriented Languages are the general purpose programming language. It is also known as the 3rd generation languages (3GL). These are designed to express the logic and the procedure of a problem. Procedural languages are very flexible becausethey are able to solve a variety of problems. Examples are: Pascal, C, BASIC, etc.
Problem-oriented language: These languages are non-procedural languages which allows the users to specify what the output should be. Problem-oriented languages are one step ahead of 3GL and they don’t describe all the details of how the data are manipulated to produce the result. These are result oriented and needs a translator like an interpreter or a compiler. Examples are: C#, PHP, Visual Basic, etc.
4GL’s objectives include:
To minimize user’s effort to obtain information from a computer.
Increase the program development speed.
Reduce the chances of errors while writing programs.
Natural language: Also known as 5th generation languages (5GL), these are still in the developing stage. In completion, we could write statements that would look like normal sentences. Natural languages such as English, Nepali and other languages would be used in the computer making them more intelligent and user-friendly.
Some of its characteristics are:
They make computers more intelligent and natural.
They make human and machine closer.
They are used in the areas of research, robotics, defense system and different types of expert systems.
The advantages of High-level languages are:
High-level languages are machine independent language. So, it is portable (i.e. program written in one processor easily runs on another processor also).
A program written in the high-level language is easier to learn because it is similar to the English language.
It is user-friendly.
Chance of error is less and it is very easy to debug.
Programming in high-level languages requires less time and effort as compared to low-level languages.
The disadvantages of High-level languages are:
The program written in the high-level language is less efficient as compared to the program written in assembly and machine language because it requires more memory and more time to execute.
The task related to the computer hardware can be programmed or handled only by either machine or assembly language. So, for these purposes,high-level languages cannot be used.
(Khanal & Rokka, 2013)
Khanal, R., & Rokka, P. (2013). Computer Essentials I. Putalisadak, Kathmandu: Asmita's Publication.
Shrestha, R. K., & Rimal, R. (2015). Computer Science I. Anamnagar, Kathmandu: Buddha Publication.
A program is a set of sequenced instructions which commands the computer to perform a particular operation or a special task.
A programming language is a language used by computers by which they understand to do what the program users want.
A programming language can be categorized as: Low-levelLanguagee (LLL) and High-Level Language (HLL).
Low-level language can be divided into two types: Machine Language and Assembly Language
High-Level Language van be divided into three types: Procedural oriented language (3GL), Problem-oriented (4th generation) language (4GL) and Natural (5th generation) language (5GL)
Questions and Answers
Click on the questions below to reveal the answers