Languages and Translators Flashcards

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

What are the two categories of languages? And provide an example for each

A

Low-level and high-level languages.
Machine code and python

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

Define machine code, assembly language and a high-level.

A

Machine code: Code compiled to binary or hexadecimal.
Assembly language: Low level symbolic code using mnemonics.
High-level: Programs written using English-like words and platform independent

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

What is the difference between imperative and declarative?

A

Imperative: Is how to achieve the goal
Declarative: States the goal

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

Difference between interpreter and a compiler

A

Interpreter: Translates code line-by-line
Compiler: Translates the whole code at once.

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

Pros and cons of a interpreter

A

Pros: Programmers get much quicker feedback - easier to debug

Cons: Slower as same section of code may be run multiple times
Programmer needs to distribute source
Customer needs to install the interpreter

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

Pros and cons of a compiler

A

Pros: Once compiled once, does not need to be compiled again
Customer does not need to buy a compiler
Programmer does not need to distribute their source.

Cons: Debugging code is slower
Object code only runs on processor type it was initially compiled for

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

Define Assembler

A

Program that takes computer instructions and converts them to a pattern of bits that the computer processor can use to perform basic operations. Used by assembly language

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

Interpreter vs Compiler

A

Interpreter
Advantage: Can start code straight away
Only needs to translate the line being run
Disadvantage: Needs to interpret every time code is ran
Needs original code and interpreter software every time

Compilers
Advantage: Creates an object code file that can be run without original code and interpreter software.
Object code runs quicker than interpreting
Hides original code
Disadvantage: Needs setup time to complete compilation

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

Define bytecode

A

Instruction set (for programming) that is executed on a computer with a virtual machine

Example: Some programming languages do not fully translate to machine code and rather to bytecode. When run the code is typically interpreted. This is a compromise between compilation and interpretation

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

Pros and cons of bytecode

A

Pros: Easy to interpret
Independent so it portable
Some protection from viruses as ran on virtual machine.

Cons: Uses more instructions so is slower than higher level languages

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

Define Opcode and Operand

A

Opcode: short abbreviations for what an instruction does using mnemonics
Operand: “data” or “inputs” instruction uses, like parameters

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

Name and define the 2 Addressing modes

A

Addressing modes: Tells instruction how or where to get any data

Immediate: data is hardcoded into the instruction

Direct: value refers to the address in the main memory where data is to be collected from

Example: Using #5 to get exact value to of 5 while direct would have 5 which refers to the memory address 5

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