1.2.2a - translators (y12) Flashcards

1
Q

What is a translator?

A

Software that converts source code to machine code.

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

What are the types of translators?

A

Compiler, interpreter, assembler.

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

What does a compiler do?

A

Converts entire source code to machine code before execution.

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

What does an interpreter do?

A

Translates and runs code line by line.

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

What does an assembler do?

A

Converts assembly language to machine code.

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

Which is faster: compiler or interpreter?

A

Compiler – produces an executable.

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

What’s a drawback of compilers?

A

Harder to debug – entire program must compile.

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

What’s a drawback of interpreters?

A

Slower execution – translates each time.

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

What is source code?

A

Code written by a programmer in a high-level language.

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

What is object code?

A

Code translated into machine code by a compiler.

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

What is machine code?

A

Binary instructions understood by the CPU.

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

What is assembly language?

A

Low-level language using mnemonics.

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

Why is translation necessary?

A

Computers can only execute machine code.

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

What’s the role of error checking in translators?

A

Finds syntax and semantic errors.

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

What is lexical analysis?

A

Removing whitespace/comments and converting tokens.

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

What is syntax analysis?

A

Checking code structure against language rules.

17
Q

What is semantic analysis?

A

Ensuring code makes logical sense.

18
Q

What is code generation?

A

Produces object code from parsed source code.

19
Q

What is optimisation?

A

Improving object code efficiency during compilation.

20
Q

Which translator is best for development?

A

Interpreter – allows testing code in real-time.

21
Q

Which translator is best for deployment?

A

Compiler – faster execution, no source code needed.

22
Q

Why use assembly language?

A

Greater control and speed – useful in embedded systems.

23
Q

What is a token?

A

A meaningful element like a keyword, identifier, or symbol.

24
Q

What is a symbol table?

A

Stores variables, functions, and their attributes during compilation.

25
What is a parsing tree?
A structure representing the grammatical structure of code.