Programming Language Questions and Answers PU BE Programming in C

Here are all the questions and solutions on topic Programming Language for BE program on course Programming in C

Q1) What is Programming Language?

Solution: A programming language is a computer language used by programmers to create software programs, scripts, or other instructions that computers can execute.

Q2) Explain different types of programming languages.

Solution: Programming languages can be classified into two different types:

1. Low-Level Programming Language

A low-level programming language is one that offers little or no abstraction of programming concepts and is very close to writing actual machine instructions. It can be further classified into the machine-level language and assembly language.

a) Machine-Level language

It is the most fundamental of all programming languages. It is represented on binary digits, which are 1s and 0s so that computers can understand it directly. As the machine reads machine-level language, it does not require any translators such as a compiler or interpreter. It executes faster and has a higher machine efficiency. Even a simple program, however, takes a long time to write. As a result, debugging is difficult. It is more prone to errors, and user efficiency is low.

Points to remember:
  • Represented on binary digits ie, 1 and 0.
  • High machine efficiency and low user efficiency
  • Every other language has to be translated into the machine-level language
  • Hard to code and debug

b) Assembly language

Mnemonics are English-like abbreviations used in assembly language. They are less difficult to program than machine language because they use short words to represent common operations such as SUM, DIVIDE, PRODUCT, and so on. Because they are not directly understood by computers, a translator known as an Assembler is used to convert assembly language into machine code.

Assembly language is machine-dependent, which means that different assembly languages are created for different types of CPUs.

Points to remember:
  • Mnemonics are used
  • Assembler(Translator) is required
  • Easy to understand and use
  • Less error-prone compared to machine-level language
  • Machine independent
  • Slower than machine-level language

2) High-Level Language

A high-level language is any programming language that allows program development in a much more user-friendly programming context and is generally independent of the hardware architecture of the computer. A high-level language is more abstract from the computer and focuses on programming logic rather than underlying hardware components such as memory addressing and register utilization.

They are easy to use and understand as their syntax is based on human language. Instead of binary digits, they use familiar English words. High-level programming languages are simple to read, write, and understand.

To convert high-level language into machine language, translators such as Compilers or Interpreters should be used. When compared to low-level languages, programs written in high-level languages run slower. Machine efficiency is low, whereas user efficiency is high.

Points to remember:
  • Closer to natural language
  • A translator like a Compiler or an Interpreter is required
  • Low machine efficiency and high user efficiency
  • Easy to write codes and debug codes
  • Less error prone
  • Easy to maintain code and easy to trace mistakes
  • Examples: FORTRAN, C, C++, Python, QBASIC, PASCAL, etc

Q3) Why is High-Level Language(HLL) preferred to Low-Level Language(LLL)?

Solution: High-level language is much closer to human language whereas low-level language is expressed in terms of machine expressions and operations. A high-level language is user-friendly, and easier to code and debug than a low-level language. They are less error-prone than machine-level language. That's why high-level language is much preferred over low-level language.

Q4) Differentiate High-Level Language and Low-Level Language?

Solution: High-level language and low-level language are differentiated in the following tables:

High-Level Programming Language Low-Level Programming Language
It is a user-friendly programming language. It is machine friendly programming language.
They use translators like compilers or
interpreter to convert it into machine language.
An assembler is required for low-level language
to directly translate machine language instructions.
High user efficiency Low user efficiency
Low machine efficiency High machine efficiency
Easy to debug Hard to trace errors and debug
Widely used by programmers They are not common nowadays.
Allow higher abstractions It allows very low abstraction or no abstraction at all.
Portable to use on different devices Less portable
Example: C, PYTHON Example: Machine code and assembly language

Q5) What is a translator? Differentiate between compiler and interpreter.

Solution: A program written in a high-level language or assembly language needs to be converted into machine-level language as machines can only read machine-level language.

A translator is a piece of software that converts source code to machine code. There are three types of translators in general:
  1. Assembler: It converts programs written in assembly language into machine code.
  2. Compiler: It translates the entire source program into an object program at once and then only the program is executed.
  3. Interpreter: It translated one program instruction at a time.
Here is the difference between a compiler and an interpreter:

Compiler Interpreter
Translate the entire source code into object code at once Translates one program instruction at a time
It is faster than the interpreter It is slower than the compiler.
Debugging is hard compared to interpreting. Debugging is easier compared to compilers.
The compiler is a complex program and larger than the interpreter. The interpreter is simple to program and smaller than the compiler.
It occupies more memory. It occupies less memory.
The program need not be retranslated for execution next time The program needs to be translated every time on execution.
Example: C, C++, FORTRAN Example: Python, QBASIC

If you have any questions on this topic to be added, please contact us. Thank you!

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.