Tuesday, September 17, 2019

Programming Language & Its concept

Programming Language & Its concept
1. What is programming language? Explain the types of programming language with its merits and demerits.
Ans: Programming language is an artificial language uses set of instructions with some mathematical notation while writing program is called computer language. The main programming languages are high level, machine level and assembly language.
The types of programming languages are as follows:
a. Low level languageIt is machine dependent programming language uses short abbreviated words and binary digits. Programmers require depth knowledge of computer architecture.
It is further divided into two parts:
i. Machine Level language
It is first generation language and written by using binary digits o (off) and 1 (on). It is machine dependent, time consuming and very difficult as programmers should have sound knowledge of computer architecture.
Merits- It is directly understood by CPU.
- It doesn’t require language processor and takes less time to execute the source code as it is directly understood.
Demerits- It is machine dependent so non portable.
- It is difficult to understand, write and debug.
ii. Assembly LanguageIt is second generation machine dependent but easy to memorize and write program than the machine level language. It uses short abbreviated words like add for addition, sub for subtraction, etc. while writing program is called mnemonics. The language processor, assembler is used to convert the assembly language into computer understandable form.
Merits- It is easier to understand and debug than the machine code.
- It is not time consuming as it uses words and letters.
Demerits- Machine oriented language so it is not portable.
- It is not fast as machine as it requires language processor.
b. High level languageThe set of instructions which are written by using simple phraseless English words with some mathematical notations following a strict syntax discipline is called high level language. It cannot understand by computer directly so compiler and interpreter are used to convert it into machine code which is object code and the original instructions is called source code.
Merits
- Simple English is used for program coding so easy to understand and debug.
- It is machine independent, problem and procedure oriented.
Demerits- It requires language processor so slower than machine.
- It is lower efficiency and flexibility.
It is further classified into three which are:
i. Procedure oriented languageIt is the 3rd generation language oriented towards the procedure for solution. It contains set of vocabulary called keywords and symbols, can be used with English like word while writing program.
ii. Problem oriented languageIt is 4th generation language closer to 5th generation. It doesn’t need step by step instructions, can be used English like words directly what the programmers want for developing their own applications. Example: SQL, PHP, etc.
iii. Natural language
It is the means of communication in between the human beings using Nepali, English, Hindi, Japanese, etc. called natural language. The language is being designed to use for artificial intelligence, natural networks and expert system as fifth generation language. Example: LISP, PROLOG, etc.
2. What is language processor? Explain its types.Ans: The program or software which is used to convert high level language and assembly language into computer understandable form or machine code is called language processor.
Following are the different types of language processor:
a. CompilerIt is a translator or language processor which converts source program written in high level language or 4GL into machine code whole at a time. Compiler reads the complete program at first and if there is syntax error free then it converts source program in object program at once so it is faster than the interpreter. It is large program and complex too so it requires more memory spaces. Example: Javac.exe, TurboC.exe, etc.
b. InterpreterIt is also language processor used to convert source program code written in 4GL or HLL into machine code line by line when CPU gets instructions. Each time program is executed, every line is checked for syntax errors and converted to equivalent machine code. It is simple, easy, takes less memory but cannot be saved for future reference however it is slower and time consuming. Eg. BASIC, LISP, etc.
c. AssemblerAssembler also a language processor which is used to convert the acronym used in assembly language into machine code. It is a little complex and difficult but not like compiler and slower than the compiler and interpreter. Eg. Microsoft Assembler.
3. What is programming? Difference between compiler and interpreter.Ans: Program is a process or technique to create a program including different steps in an organized way using different types of programming language.
Compileri. It translates high level language to machine whole program at a time.
ii. It is slow for debugging.
iii. It creates an object program.
iv. All the errors in the program are reported at once.
v. It takes less time to execute the program.
Interpreteri. It also translate high level language to machine code each statement at a time.
ii. It is faster in debugging.
iii. It does not create object program.
iv. It reports the error at each time.
v. It takes more time for execution the program.
4. What are the two types of programming errors? How are they detected?Ans: Following are the two types of errors:
a. Syntax error: 
Any deviation from the syntax in the expression in a program results in error called syntax error. The syntax errors are detected by compiler during compilation process, and the program terminates by displaying these errors.
b. Semantic error:
The error that is related to logic of the program is called semantic. The semantic error are also called logical errors which can be caused due to a wrong path, elimination of some condition or improper use of operators etc. These types of error can not be detected easily by compiler so after compilation when result will be found and produces wrong result.
Following are the way of finding errors:i. Run time error can be found only when the code is compiled and run, but the result will be invalid which is due to mismatch of data type and difficult to isolate it.
ii. The logical error are displayed due to the wrong path, elimination of condition and improper use of operator and can be found only when it is executed and analyzed the result.
iii. Latency error is also called hidden error that is displayed only when a particular set of data, items are used. For example, let us take statement R = (A+B)/(A-B), in computer calculation, there will be error only when A and B are equal.

0 comments:

Post a Comment