11.1 Programming Languages Flashcards

1
Q

Levels of programming languages

A

Since the invention of the computer, people have needed to learn how to communicate with them using programming languages.
Early computers were complex and instructions would have to be in written in binary code, 0s and 1s.
This process was slow, taking days to program simple tasks.
Over time, new generations of programming languages have enabled people to become faster and more e fficient at writing programs as they resemble human language.
Generations of programming languages can be split in to two categories:
Low-level - First generation and Second generation
High-level - Third generation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Low level languages

A

A low-level language is a programming language that directly translates to machine code understood by the processor.
Low-level languages allow direct control over hardware components such as memory and registers.
These languages are written for speci fic processors to ensure they embed the correct machine architecture.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

First generation

A

Machine code is a First-generation language.
Instructions are directly executable by the processor.
Written in binary code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Second generation

A

Assembly code is a second-generation language.
The code is written using mnemonics, abbreviated text commands such as LDA (Load), STA(Store).
Using this language programmers can write human-readable programs that correspond almost exactly to machine code.
One assembly language instruction translates to one machine code instruction however it Needs to be translated into machine code for the computer to be able to execute it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Advantages and disadvantages if low level languages

A

Advantages - Complete control over the system components.
Occupy less memory and execute faster.
Direct manipulation of hardware.

Disadvantages - Di cult to write and understand.
Machine dependent.
More prone to errors.
Knowledge of computer architecture is key to program e ffectively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

High level languages

A

A high-level programming language uses English-like statements to allow users to program with easy to use code.
High-level languages allow for clear debugging and once programs are created they are easier to maintain.
High level languages were needed due to the development of processor speeds and the increase in memory capacity.
One instruction translates into many machine code instructions.
Examples of high-level languages include: Python, Java, Basic and C+

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Advantages and disadvantages of high level languages

A

Advantages - easier to read and write.
Easier to debug.
Portable so can be used on any computer.
One line of code can perform multiple commands.

Disadvantages - The user is not able to directly manipulate the hardware.
Needs to be translated to machine code before running.
The program may be less efficient.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Translator

A

A translator is a program that translates program source code into machine code so that it can be executed directly by a processor.
Low-level languages such as assembly code are translated using an assembler
High-level languages such as Python are translated using a compiler or interpreter.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Compiler

A

A compiler translates high-level languages into machine code all in one go.
Compilers are generally used when a program is finished and has been checked for syntax errors.
Compiled code can be distributed (creates an executable) and run without the need for translation software.
If compiled code contains any errors, after fi xing, it will need re-compiling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Advantages and disadvantages of compilers

A

Advantages - speed of execution
Optimises the code
Original source code will not be seen

Disadvantages - can be memory intensive
Difficult to debug
Changes mean it must be recompiled
It is designed solely for one specific processor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Interpreter

A

An interpreter translates high-level languages into machine code one line at a time.
Each line is executed after translation and if any errors are found, the process stops.
Interpreters are generally used when a program is being written in the development stage.
Interpreted code is more di ffcult to distribute as translation software is needed for it to run.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Advantages and disadvantages of interpreters

A

Advantages - stops when it finds a specific syntax error in the code
Easier to debug
Requires less RAM to process the code

Disadvantages - slower execution
Every time the program is run it has to be translated.
Executed as is, no optimisation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly