2.2 Flashcards

(16 cards)

1
Q

What is a translator?

A

A program that translates program source code into machine code for execution by a processor

Translators include assemblers for low-level languages and compilers or interpreters for high-level languages.

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

What is a compiler?

A

A program that translates high-level languages into machine code all in one go

Compilers are used when a program is finished and has been checked for syntax errors.

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

What is a key feature of compiled code?

A

Compiled code can be distributed and run without the need for translation software

It creates an executable file.

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

What happens if compiled code contains errors?

A

It must be fixed and then re-compiled

This process is necessary to ensure the code runs correctly.

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

List two advantages of using a compiler.

A
  • Speed of execution
  • Optimises the code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

List two disadvantages of using a compiler.

A
  • Can be memory intensive
  • Difficult to debug
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an interpreter?

A

A program that translates high-level languages into machine code one line at a time

Each line is executed after translation.

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

What happens if an interpreter finds a syntax error?

A

The process stops

This allows for immediate debugging.

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

When are interpreters generally used?

A

When a program is being written in the development stage

They provide immediate feedback during coding.

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

List two advantages of using an interpreter.

A
  • Easier to debug
  • Requires less RAM to process the code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

List two disadvantages of using an interpreter.

A
  • Slower execution
  • Every time the program is run it has to be translated
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Fill in the blank: Compilers create _______ that can be distributed.

A

[executables]

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

Fill in the blank: Interpreted code is more difficult to _______.

A

[distribute]

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

True or False: Compiled code is executed as is without the need for translation software.

A

True

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

True or False: Interpreters optimise the code during execution.

A

False

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

Fill in the blank: A compiler is designed solely for one specific _______.