3.3 Programming Languages (B03) Flashcards

1
Q

how does CPU run high level code?

A

Your high level code is translated to ‘low level’ instructions by a compiler or interpreter.
An assembler then converts the assembly code instruction into binary code (known as machine code and sometimes as object code) that the CPU can understand.

Some translators convert your high level code straight to machine code.

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

features of high level languages

A

Each line of code may = multiple low level instructions.

Platform-independent – can be translated to a particular CPU architecture.

It abstracts away specific details of how parts of the code operates: we can store variables without needing to know the machine’s memory structure.
The drawback of this is that we don’t have as much control over the CPU in some languages, so some programs may be less efficient because they cannot make optimal use of the CPU’s architecture.

Must be translated before it can be run.

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

features of low level languages

A

One assembly code construction = one line of machine code, doing one specific action.

Assembly code instructions are specific to a particular machine/CPU architecture.

Programmer needs to know about specific operations of the CPU, e.g. how memory is managed.

More control over what the hardware does, therefore can be more efficient.

Can be executed directly without needing to translate/interpret.

Difficult to manage, read or update code.

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

key difference between high- and low-level languages

A

High level languages are friendlier to read, but programs run more slowly because the code structure is based on a human-friendly structure.
In contrast, programs written in low level languages can run very quickly as it is based on the computer’s hardware architecture.

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

exam question!

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

machine code

A

the lowest level programming language - written in binary

commands that can be directly executed by a processor

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

instruction set

A

all the different machine code instructions a microprocessor (CPU) can execute

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