Information and Communication Technology English Version chapter 5: Programming Language
- Information and Communication Technology English Version
- Textbook pages 145-189
- 1 source
- 69,956 characters of context
Textbook (verbatim transcription): Programming Language
Verbatim transcription of the printed NCTB textbook pages.
Contents28ShowHide
- Programming Language
- 5.1 Programming Language
- 5.1.1 Machine Language
- 5.1.2 Assembly Language
- 5.1.3 Mid-Level Language
- 5.1.4 High Level Language
- 5.1.5 4<sup>th</sup> Generation Language
- 5.2 Translator Program
- 5.3 Program Structure
- 5.4 Steps of Developing a Program
- 5.5 Program Design Model
- 5.6 C Programming Language
- C Compiler
- Hello World
- Data types
- Char
- Int
- Float
- Double
- Input Output Statements
- Conditional Statements
- Relational Operators
- If statement
- Logical Operators
- Loop Statements
- For loop
- Function
- Exercise
Printed page 145
Chapter Five
Programming Language
Figure: Students participating in a programming contest
Computers have touched the lives of every human in some way or the other over the past few decades. The potentials of what can be done with this machine are limitless. What is the difference of computer and any other machine? Well, the main advantage of a computer is, it can be programmed in a certain way to do certain tasks. But a computer is only an electronic machine after all, it can not understand human language. We can only make it understand binary, 0 and 1. To program a computer, we must provide instructions in machine code, with 0s and 1s. Writing machine code is nor at all easy for a human being, so we have developed many programming languages. You can write codes in one of these languages then your code is converted to machine codes and sent to the computer for execution. C is such a programming language. C is very popular and widely used as a programming language. In this chapter students will learn the basics of programming and with that the basics of C language too.
After completing this chapter students can
- Explain the concepts of programming
- Describe different levels of programming languages practical
- Demonstrate programming structure
- Make algorithms and flowcharts
- Use C language to write codes.
Printed page 146
5.1 Programming Language
If you want to get the computer do a particular task, you have to provide a special set of instructions. A computer processor can only execute a particular set of commands which are known as the instruction set. But real life programmers do not usually use the instruction sets. To make life easier for them, over time we have created countless programming languages to translate our instructions to the computer.
Some popular programming languages invented over the past decades
| Programming language | Year of invention |
|---|---|
| Fortran | 1954-57 |
| Lisp | 1956-59 |
| Cobol | 1959-60 |
| Basic | 1964 |
| Pascal | 1970 |
| C | 1972 |
| C++ | 1983 |
| Perl | 1987 |
| Python | 1989 |
| Programming language | Year of invention |
|---|---|
| Visual Basic | 1991 |
| PHP | 1995 |
| Java | 1995 |
| Javascript | 1995 |
| Scala | 2003 |
| Go | 2009 |
| Rust | 2010 |
| Kotlin | 2011 |
5.1.1 Machine Language
We already know that a computer processor can only recognize binary numbers. Binary numbers contain only two digits - 0 and 1. So to get a machine to understand and execute our instructions, we have to provide a code with only 0 and 1 in it. This is known as the machine code and the language is known as machine language. Although machine codes are easily understood by the machine, its nearly illegible for a human being. As the codes contain only 0s and 1s, writing a program in machine language is a really arduous task to say the least.
Figure: Figure 5.4: First programmer Ada Lovelace(1815-1852)
Printed page 147
The processor manufacturers usually provide an instruction set with their processor so that programmers may use them. This set contains some simple instructions that can be used to write programs and which is a lot easier than writing programs in machine language.
5.1.2 Assembly Language
Assembly language was invented after the machine language so the programmers can write programs with relative ease. This is a programming language that has English words and instructions in it alongside numbers. So it is more comfortable to use and learn for a programmer. A computer processor can not however run a program written in assembly, it has to convert the code to machine language first. A program named ‘Assembler’ is used to convert an Assembly Code to Machine Code.
5.1.3 Mid-Level Language
Mid level languages stand between Assembly and high level languages. Mid level languages are really handy to use when you require a direct interaction between hardware and your programming. C is a great example of a mid level language. With C you can write system programs like operating systems and you can also write software applications for everyday use.
5.1.4 High Level Language
Machine language and Assembly Language are known as low level languages. Though Assembly made it easier for programmers to understand the code, it takes a lot of time and effort to write a program in Assembly or even understand a program written by someone else. So people felt the need for a more legible and easy to use language. Mid and High level languages were created to meet this demand. Mid level languages like Fortran, Cobol and C revolutionized the field of programming. They were easy to learn and easy to use, so more people got involved in computer programming. With time we created high level languages like C++, Java, C#, Python and many more. These high level languages are so easy to use and understand that a code written in any of these languages is close to English language itself.
C
C is a very popular programming language which was invented by Dennis Ritchie in Bell Communications Laboratory in 1972. There is a saying that, if you know C, you can learn any programming language. C can be used to create complex software systems like the operating system, database management systems, internet browsers and many more. C is a structured programming language that can be used to create massive and complex programs.
Printed page 148
C++
Class is a very important concept in the field of programming. Objects of similar attributes are defined by a class. Adding Classes and some new and exciting features with the C language Bjarne Stroustrop created the C++ ;language in 1980 working at Bell Laboratory. The main theme of C++ is to give the programmer a lot of freedom in writing their codes.
Java: In 1991, sun micro system introduced Java programming language. At present it is a popular language. The main characteristic of it is compiled in a platform, using Java it can be used directly (WORA: Write Once, Run Anywhere). As the important web browsers permit to use applet in the webpage, it has become popular among all people.
Python
Python was invented by Gido Van Rossum in 1991. Python is one of the most popular programming languages of the present and in 2018 IEEE recognized Python as the greatest programming language. Python’s best feature is it’s readable syntax and easy to use structure. Python codes can run in multiple platforms and are generally used in developing cloud based web applications, data analytics and machine learning applications.
5.1.5 4th Generation Language
The goal of 4th generation programming languages are to make programming easier for general people and so that the codes resemble human languages. The SQL language we are going to learn in the Database chapter is a 4GL language. The graphical user interfaces we use in different tools and softwares are the direct result of 4GL.
5.2 Translator Program
At present there are thousands of programming languages being used by millions of programmers. Though most of these languages are different in structure and syntax, all of them must be compiled into machine codes so that computers can execute the sets of instructions. A translator program does exactly that. We will learn about three types of translator programs.
Assembler
Assembler converts a code written in Assembly language to a machine code. High level languages use two different types of translator programs to convert their codes to machine codes. These are compilers and interpreters. Every high level language has different sets of compilers and interpreters.
Printed page 149
Compiler
A compiler program scans through a code to detect if the code is written following all the standards and syntax of that particular programming language. If everything is okay and no error is found, the compiler converts the code into machine code. As the whole program is compiled together so all the errors are shown together too. This makes correcting errors a bit difficult and radius. But once compiled, the programs can run really fast.
Interpreter
An interpreter does not run through the whole program at once but check each statement individually and convert each statement into machine code. If a program has 10 statements, an interpreter will first convert the first statement to machine code and execute it, then the second, then the third and so on. This makes finding and correcting errors in the coding really easy. But the interpreter program takes a lot of time to finish executing.
Loading the rest of the chapter…
Textbook content © National Curriculum and Textbook Board (NCTB), Bangladesh. Shown for study.
Trusted resources
Official links checked by the Zntext team. Part of the context pack.