4.6 Fundamentals of Computer Systems (Translators) Flashcards

1
Q

What is the need for translators

A

-Program code can only be excecuted in machine code meaninng programs in assembly or HLL need to be translated into machine code
before they can be executed by a computer

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

How does an Interpreter work

A
  • Translates and exceucutes each line of code line-by-line.
  • For each line a syntax-check is performed and if there are no errors it calls predefined routines to translate lines.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the advantages of Interpreters

A
  • They can run syntactically correct parts of code evemn when there are errors in other parts of code
  • They can be used for debugging and development as they terminate at errors and can be used for testing in a sandbox
  • More portable than compilers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Drawbacks of using an interpreter

A
  • Program code will need translating every time. This means that the overall time needed
    to execute a program can be very long.
  • The process of using it takes up a lot of system resources like RAM as memory space is need for both the source code and the interpreter
  • The source code can only be translated and therefore executed on a computer that has the same interpreter installed.
  • The source code must be distributed to users, whereas with a compiled
    program, only the executable code is needed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How does a compiler work

A

A compiler converts the whole source code into object code before the program can be executed.

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

Benefits of using a compiler:

A
  • Once the source code has been compiled you no longer need the
    compiler or the source code and you normally don’t need to recompile.
  • If you want to pass your object code on to someone else to use it is difficult to reverse engineer to obtain the source code
    -Compiler optimises code in the form of object code , as it does not need to be translated but only executed meaning that it runs faster.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Drawbacks of using a compiler:

A
  • Because the whole program has to be recompiled every time you make even the slightest alteration to your
    code, it can take a long time to debug.
  • The compiled code will only execute on a computer with the same processor instruction set
  • The compiler will not produce an executable file if a syntax error is encountered.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does an assembler do

A

Assemblers translate assembly code programs into executable code.

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

What is Intermediate code (bytecode)

A
  • A semi compiled form of code that is not directly executable
  • Containing hardware specific parameters and instructions that will be run by a virtual machine, which is platform independent
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How is intermediate code used subsequently

A
  • An interpreter is used to convert the hardware specific instructions of the intermediate code into machine code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why do some compilers produce intermediate code as a final output

A
  • Can be executed on any computer using it regardless of the specific processor instruction set.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the difference between source and object code

A

Source code is the human-readable code written by a programmer, while object code is the machine-readable output produced after the source code is compiled.

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

Why is it an advantage to use as few gates as possible in a logic circuit

A
  • Minimises the cost of production
  • Reduces delay and speeds up processing
  • Reduces Power consumption as less system resources will be used.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Explain the general purpose of a D Type Flip Flop

A

synchronous sequential circuit that is used to store state of a single binary data input, and also as a memory unit

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