Java notes: Programming languages

Q1) What is a computer program?

A1) Computer programs, called software, are instructions that tell the computer what to do.

Q2) What is Machine Language?

A2) Machine language, a computer’s native language, is a set of built-in primitive instructions. These languages are in the form of binary code, so if you want to give a computer an instruction in its native language, you have to enter instructions in its native language.

Q3) Why was Assembly Language created?

A3) Programming in machine language is a tedious process. Moreover, programs written in machine language are very difficult to read and modify. For this reason, Assembly Language was created.

Q4) What is assembly language?

A4) Assembly language uses a short descriptive word, called mnemonic, to represent each of the machine language instruction. For example, “add” is a mnemonic used to add two numbers.

Q5) What is an assembler?

A5) A computer cannot execute assembly language. Another program- called an assembler- is used to translate assembly language programs to machine language code.

Q6) What are the downsides of assembly language? Why is assembly language called low-level?

A6) Writing code in assembly language is easier than writing code in machine language. However, it is still tedious to write code in assembly language. An instruction in assembly language corresponds to an instruction in machine language. Writing in assembly language requires that you know how the CPU works.

Assembly Language is referred to as low level language because is it close in nature to machine language and is machine dependent.

Q7) Briefly elaborate on High-Level Languages?

A7) High level languages are platform independent, which means that you can run write a program in a high level language and run it on different types of machines. High level languages are similar to English and easy to learn and use. The instructions in High level languages are called statements. For example,

result= 3+3*2.345/2;

There are many high level languages designed for specific purposes.

Q8) What is source code?

A8) A program written in high level language is called source code or source program.

Q9) What is interpreter? What is compiler? What is the difference between the two?

A9) A computer cannot execute the source program. Therefore, an interpreter or compiler is used to convert high level language to machine code for execution.

An interpreter translates and executes a program one statement at a time.

A compiler translates the entire source program into a machine-language file for execution.

Check point questions:

1.3.1 What language does the CPU understand?

Machine Language

1.3.2 What is an assembly language? What is an assembler?

Assembly language is a low-level language which uses mnemonics to represent machine language instructions. For example, “add” is used to add two numbers.

An assembler is a program that converts assembly language to machine language.

1.3.3 What is a high-level programming language? What is a source program?

High level programming languages are a new generation of programming languages that similar to English and easy to use. They are platform independent, which means that a program written in a high level programming language can be run on any machine.

A source program or source code, is a program written in a high level language.

1.3.4 What is an interpreter? What is a compiler?

Both interpreters and compilers are programming tools that are used to convert high level language to machine language code.

1.3.5 What is the difference between an interpreted language and a compiled language?

An interpreter reads one statement from the program, translates it to machine code, then executes it right away

A compiler converts the entire source program to machine code and then the machine code file is executed.

Leave a Reply


Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: