5.1 Languages & Translators Flashcards

1
Q

Why do programmers use high-level languages?

A

High-level programming languages use code written in a way that is similar to a natural human language, such as English, making it easier to understand and use the language.

Using high-level languages leads to fewer errors and allows for more powerful and complex commands compared to low-level languages.

However, a high-level language must be translated into machine code (binary) before it can be run, as high-level languages cannot be executed directly by the CPU.

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

Low-Level Languages

A

Low-level languages do not closely resemble a natural human language, making it harder for humans to understand and write in.

Low-level languages are used when a program must be executed quickly or when programmers need to write code that interacts directly with the hardware, such as device drivers.

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

What are the two types of Low-Level Languages

A

. Machine code
. Assembly Language

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

Machine Code

A

This is the pure binary code that computers can directly process and execute.

It is extremely tedious and difficult for humans to understand and write machine code.

However, machine code can be used when a programmer needs to perform a very specific command that can’t be done in a high-level language.

Machine code will be executed faster than high-level programs because it is already in a format the CPU can execute and does not need to be translated.

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

Assembly Language

A

Assembly language uses specialised command mnemonics to perform actions. See the Assembly Language section in the programming tab for a list of mnemonics such as INP, OUT and HLT.

Assembly language is preferred by many programmers over machine code because it is easier to understand and spot errors.

It is faster to execute than high-level languages and, like machine code, can be used to directly control the CPU.

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

What is a translator

A

A translator changes (translates) a program written in one language into another language (usually machine code).

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

What are the two types of translator

A

. Interpreter
. Compiler

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

Interpreter

A

An interpreter converts high-level language one line at a time into machine code and executes it.

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

Compiler

A

A compiler converts high-level language into machine code for execution at a later time. The entire program is converted at once.

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

Interpreters vs Compilers : Execution Method

A

An interpreter translates source code (high level code) into machine code one line at a time.

A compiler translates all the source code (high level code) into machine code in one go.

A compiler produces an executable file that will run on other machines without the compiler needing to be installed.

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

Interpreters vs Compilers : Execution Speed

A

An interpreter is slower than a compiler because the code must be reinterpreted each time the program is run.

Compilers can produce much more efficient code than interpreters making the compiled programs run faster.

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

Interpreters vs Compilers : Complexity

A

Interpreters are smaller, simpler programs.

Compilers tend to be large complex programs.

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

Interpreters vs Compilers : Error Reporting

A

In error reporting, the interpreter would encounter the errors and report it to the user immediately and stops the program from running.​

​The compiler would analyze the entire program, taking note of where errors have occurred and record them in an error file.

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

Interpreters vs Compilers : Repetition

A

Interpreted programs can be edited and run without translating the whole program.

Interpreters must reinterpret the program every time it is run.

Compilation requires analysis and the generation of the code only once, whereas interpreters must re-interpret each time.

However, compiled programs have to be re-compiled after any changes have been made.

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