Classification Of Programming Languages

4.6.2 (12 questions). Public Notes: AQA's A Level Computer Science

State two forms of high level languages.

  1. Imperative.
  2. Declarative.

Define imperative high level languages.

Languages which provide instructions on how a computer should perform a task.

Define declarative high level languages.

Languages which focus on what the result of a computer program should be.

State two forms of low level languages.

  1. Machine code.
  2. Assembly Language.

Define machine code.

Binary instructions which directly manipulates the processor and space in memory.

Define assembly language.

  1. An abstraction of machine code, with a 1-1 correspondence with binary instructions.
  2. Mnemonics replace binary instructions, register name codes.
  3. Hexadecimal replace binary data.

State the four categories of comparison between machine code, assembly language and high level languages.

  1. Portability.
  2. Ease of use.
  3. Ease of debugging.
  4. Speed of execution.

Compare the portability of machine code, assembly language and high level languages

  1. Both machine code and assembly language are processor-type specific and different due to different instruction sets.
  2. High level languages can be translated to run across a range of processor types.

Compare the ease of use of machine code, assembly language and high level languages.

  1. Machine code is difficult for humans to understand, which increases development time and frequency of errors.
  2. Assembly language implements mnemonics which, makes it slightly easier for humans to understand, but less so than high-level languages.
  3. High level languages are very easy for humans to understand as they close to human language, include many more programming structures such as iteration.

Compare the ease of debugging of machine code, assembly language and high level languages.

High level languages are far easier to debug than low level languages because of named variables, indentations and human language commenting.

Compare the speed of machine code, assembly language and high level languages

  1. Machine code requires no translation as the processor can directly understand binary instruction, fastest.
  2. Assembly language requires translation into machine code by an assembler, however due to the 1-1 correspondence this is very quick and execution speed is comparable to machine code.
  3. High level languages must use a complier or interpreter, to translate program code into machine code. This is slow, time-consuming and the potential for code to optimised to the hardware instance it will run on is limited so even execution time is slower.

Describe a situation where an assembly language would be an appropriate choice, giving reasons why.

Device drivers for keyboards or other peripheral devices.

  1. Here a low level language must be used because it requires manipulation of individual bits, which a high level language cannot do.
  2. Furthermore they may have a built in embedded system, using which they interface with the CPU’s IO controller. These often have low main memory requirements, and assembly code usually takes less space in memory than an equivalent high level language.