Computer Systems - Translators Flashcards

1
Q

What are the two types of computer languages?

A

High-level
Low-level

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

What a high-level language?

A

A source code easy for humans to write but computers need to translate it before they can read it and run it

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

What is a low-level language?

A

Tricky for humans to read but easier for a computer to run

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

What do low-level languages consist of?

A

Machine code
Assembly code

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

What is machine code?

A

Very tricky for humans to understand - each processor (or family of processors will have its own specific machine code

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

What does machine code look like?

A

Binary - 000000 00001 00011…

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

What is assembly code?

A

More readable for humans and easier to remember

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

Why is it good if a code is easier to remember?

A

Programmers are less likely to make mistakes when wriitng assembly code than machine

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

When is assembly code used?

A

When developing software for embedded systems and when programmers need more control over specific hardware

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

What are the advantages of high-level languages?

A

The same code will work for many different machines and processors
The programmer can easily store data in lots of different structures (list and arrays) without knowing about the memory structure
Code is easy to read, understand and modify

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

How many instructions of machine code is high-level code?

A

One instruction of high-level code represents many instructions of machine code

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

What are the disadvantages of high-level language?

A

Must be translated before a computer is able to understand it
You don’t have much control over what the CPU actually does - programs will be less memory efficient and slower

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

How many instructions of machine code is assembly code?

A

One instruction of assembly code usually represents one instruction of machine code

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

What are the disadvantages of low-level code (machine code)?

A

Usually written for one type of machine/processor - won’t work on other
The programmer needs to know about the internal structure of the CPU - how it manages memory
Code is difficult to read, understand and modify

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

What are the advantages of low-level code (machine code)?

A

Commands in this code can be executed directly without need of a translator
You control exactly hat the CPU does and how it uses memory - memory will be more memory efficient and faster

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

What are the 3 types of translators?

A

Assemblers
Compilers
Interpreters

17
Q

What do assemblers do?

A

Translate assembly language directly into machine code - different types of assembly language needs its unique assembler

18
Q

What do compilers do?

A

Translate high-level code directly into machine code, and create an executable file

19
Q

What do interpreters do?

A

Take each instruction in the code and call machine code subroutines within their own code to carry out the instruction

20
Q

Why is a compiler bad for debugging?

A

It returns a list of errors for the entire program once compiling is complete

21
Q

Why is an interpreter good for debugging?

A

It will return the first error it finds and stop

22
Q

How fast is a compiler?

A

Once compiled, the program runs quickly - compiling can take a long time

23
Q

How fast is an interpreter?

A

It will run more slowly (than a compiler) because the code is being translated as the program is running

24
Q

How often are compilers needed?

A

Only needed once to create the executable file

25
Q

How often are interpreters needed!

A

Every time you want to run the program (bad)