Translators Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is Source Code?

A

Source code is the program code that is written by a programmer. Most source code programs are text files that can be created using a simple text editor.

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

When does source code need to be translated before it can be executed?

A
  • When it’s written in high level languages, source code needs to be translated into machine code.
  • If they’re already in machine code they don’t need to be translated.
  • The processor can only analyse machine code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does machine architecture–dependent mean?

A

To run a program, the source code must be translated into object code according to the low-level features of the operating system and the instruction set has to be hardcoded into the computer’s chipset

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

What are high level languages?

Give 2 examples

A
  • Languages that are…

Python, Java

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

What are low level languages?

Give 2 examples

A
  • Languages that sit close to the computer’s instruction set

- Assembly language, Machine code

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

How is it determined which translator is used to translate a high level language?

A

It’s determined by the particular implementation of a programming language, some provide only one option, some provide both

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

What does a compiler do?

A

It translates the code all at once but does not execute it

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

What are the advantages of using a compiler?

A
  • Produces executable code in a form that cannot be read by a human or readily reverse-engineered, so the source code is more protected
  • It translates all the code at once so it’s faster
  • Appropriate when the object code is going to be distributed or sold
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does an interpreter do?

A

Interpreters translate and execute each line of source code one by one

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

What are the advantages of using an interpreter?

A
  • can test the code and to quickly identify and fix errors.
  • Interpreters are useful in the development stage of a program as they don’t need to recompile every time an error is discovered
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does an assembler do?

A

Assemblers translate assembly code programs into machine code.

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

What is Bytecode?

A

Bytecode is source code that has been compiled into low-level code designed to be run on a virtual machine so it speeds up the translation process.

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

2 advantages of using Bytecode

A
  • The source code is executable on a wide range of platforms as its platform independent
  • Provides an extra level of protection as a separate bytecode interpreter is used.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How does an assembler translate code from a high level into a low level?

A

It translates the source code (the input) into the equivalent 1’s and 0’s in machine code, producing object code.

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

How does a compiler translate code from a high level into a low level?

A

It scans over the source code several times performing checks and building up tables of information to produce the final object code

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

How does an interpreter translate code from a high level into a low level?

A
  • It uses subroutines that carry out high level instructions
  • It analyses each line of source code for syntax errors, if there are none it calls the appropriate subroutine to execute the command.