Difference between revisions of "Classification of Programming Languages"

From AQA Computer Science
Jump to: navigation, search
(Quiz)
(Quiz)
Line 54: Line 54:
  
 
=Quiz=
 
=Quiz=
<quiz display=simple>
+
<quiz>
  
 
{ What is the only First generation language?
 
{ What is the only First generation language?
Line 120: Line 120:
 
+In error critical situations.
 
+In error critical situations.
 
-Everyday use.
 
-Everyday use.
 +
 +
{ Why are Low level languages still used?
 +
|type="()" }
 +
- Why not?
 +
- Prevents damage to the computer.
 +
+ Allows low level access to the PC hardware.
  
 
</quiz>
 
</quiz>

Revision as of 16:28, 5 January 2019

Overview

https://www.youtube.com/watch?v=yORSZkhNpZ4&index=1&list=PLCiOXwirraUDJYD-VxmztyhsDP0QM2BHW

Low Level vs High Level

https://www.youtube.com/watch?v=tl-96ZypmpQ&list=PLCiOXwirraUDJYD-VxmztyhsDP0QM2BHW&index=2

Low Level Languages

Machine Code

Machine code is the basic binary information required for a computer to perform a function. It is classified as a 1st generation programming language. Each command is binary pattern, ie 100001 might be load, or 100010 might be add or 100011 might be store.

This is essentially writing a program by coding the binary. This provides direct access to the hardware and all programs are converted to machine code at some point.

Assembly Language

Assembly language is a low level, 2nd generation programming language, purposed towards fast execution and complete control over hardware. It replaces a binary pattern with a more readable mnemonic, ie a command word.

One assembly language instruction is equivalent to one machine code instruction, and an assembler is used to convert the assembly language to machine code.

Relationship Between Machine Code & Assembly Language

One machine code instruction will create one assembly language instruction. Remember assembly language is essentially replacing a binary pattern with a command word.

Terms

Mnemonics

An identifiable text label for a particular command (rather than requiring a programmer write instructions in binary).

Source Code

The source code is a program as written by the programmer.

Object Code

The object code is generated by the interpreter, compiler or assembler.

High Level Languages

The main characteristics of a high level language are:

  • It is easier for the programmer to identify what a command does (English words)
  • High level languages need to be translated
  • One command in a high level language represents many lines of code in assembler or machine code
  • They are portable between systems
  • More straight forward to program
  • Wider variety of data structures

Imperative

Imperative, or procedural, programming languages break down processes into functions or methods, which are all given mnemonics. A single statement of an imperative language is converted to multiple machine code instructions by a language translator (such as an interpreter or compiler), which are then executed in sequence. Imperative languages are part of the 3rd generation of programming languages. Examples of imperative languages include C++, Python and Visual Basic.

Declarative

Often referred to as 4th generation Languages, Declarative languages allow the programmer to specify what they want to produce, without having to say how to achieve it.

For example SQL is declarative, you say what you want to select, where to select it from, and what conditions apply. The SQL server will then execute your request according to its coding and provide you with the results.

Quiz

Point added for a correct answer:  
Points for a wrong answer:
Ignore the questions' coefficients:

1. What is the only First generation language?

SQL
SQL is actually a fourth generation language.
PHP
PHP is an example of a third generation language.
Machine Code
Correct, it consists of only binary values.
Assembly language
Assembly language is based off of a first generation language, but it isn't one.

2. Which of these is an imperative programming language?

SQL
Incorrect.
Prolog
Incorrect.
C++
Correct.

3. Which generation does not use mnemonics?

Gen 1
Correct.
Gen 2
Incorrect.
Gen 3
Incorrect.
Gen 4 and above.
Incorrect.

4. What generation of programming language is C++?

1st
2nd
3rd
4th

5. What level of programming language is harder for the user to understand?

Low level language
High level language

6. Which of the following are higher level 3rd generation languages?

C
VB
C++
Python
Assembly Language

7. What is the relationship between assembly language and machine code?

1 line of assembly language = 1 line of machine code
1 line of assembly language = 2 line of machine code

8. When should you use low level languages

In time critical situations.
In college to look good.
In error critical situations.
Everyday use.

9. Why are Low level languages still used?

Why not?
Prevents damage to the computer.
Allows low level access to the PC hardware.

Your score is 0 / 0