6 Types Of Languages And Translators Flashcards

1
Q

What are the three types of translator?

A
  1. Assembler
  2. Interpreter
  3. Compiler
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do interpreters work?

A
  1. Interpreters go through the source code and translate one line at a time.
  2. As soon as the line has translated it is run.
  3. If it reaches a syntax error the translator stops
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do compilers work?

A
  1. The compiler translates all the lines of code at once
  2. If there is a syntax error nothing will be translated
  3. If there isn’t then it produces an executable machine code file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why and what are interpreters used for?

A
  1. Interpreters are used for testing.
  2. They are initially faster at translating than compilers
  3. They translate up to a syntax error making error trapping easy
  4. The source code is processor independent
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why and what are compilers used for?

A
  1. Compilers are used for translating the final piece of code to give to a client
  2. They create a machine code file so source code doesn’t have to be given out
  3. Once translated the machine code runs faster
  4. Once translated translation software is no longer needed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a 1st generation language?

A

Machine code
Written in 1s and 0s
Code has to be written uniquely to each processor

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

What is a 2nd generation language?

A

Assembly code
Translated using an assembler
Simple commands that have a direct binary equivalent
E.g. CISC instruction set

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

Give an example of a 2nd generation language

A

CISC instruction set

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

What is a 3rd generation language?

A

English like syntax that has no binary equivalent
Translated using interpreter or compiler
Imperative
E.g. python

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

Benefits and features of a 3rd generation language

A

Easy for humans to understand.
Machine independent
Has a runtime environment
Has syntax highlighting

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

What is a 4th generation language?

A

Declarative meaning written in English like commands that tell the computer what to do but not how to do it.
E.g. SQL

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

What is imperative programming?

A

When the programmer writes the instructions that the computer exactly follows to execute a task

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

What is declarative programming?

A

When the programmer writes commands telling the computer the information needed but not how to get it. Used in data base management

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

Name 2 advantages of low level languages

A
  1. Allows closer control of registers and cpu
  2. Do not need translating so they run faster
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is bytecode?

A

Also known as intermediate code bytecode is an intermediate language that is executed on virtual machines.

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

What is the advantage of bytecode?

A

Allows platform independence as it can run on any computer that has the virtual machine installed.

17
Q

What is the disadvantage of bytecode?

A

Typically slower than normal code