2.5 Flashcards
1
Q
What is a compiler?
A
- Translates source code from high level languages into machine code
- Whole program is translated into machine code in one go into an executable file before run
2
Q
What are the advantages of a compiler?
A
- No need for translation software at run-time
- Faster execution speed
- Code is optimised
3
Q
What are the disadvantages of a compiler?
A
- Will not run with syntax errors (hard to debug) as the errors are reported at the end
- Code needs to be recompiled when the code is changed
4
Q
What is an interpreter?
A
- Translates source code from high-level languages into machine code
- Translated line by line as the program is running
5
Q
What are the advantages of an interpreter?
A
- Easy to write source code, program will always run, until it finds a syntax error
- Easy for beginners to learn to write code
6
Q
What are the disadvantages of an interpreter?
A
- Translation software is needed at run-time
- Slower execution speed
- Code is not optimised
7
Q
What is a high level language?
A
- Source code is aimed at humans
- Structure and syntax similar to English
- Must be translated to machine code by a compiler/interpreter
- Works on different types of processors
- Easy to write and understand code
- Less memory efficient
- Slow execution if not optimised
- Large number of instructions
- One source code = multiple machine code instructions
- e.g. python, java, c++
8
Q
What is a low-level language?
A
- Translated by an assembler into machine code
- Used for embedded systems/device drivers (instructs hardware directly)
- One source code instruction = one machine code instruction
- Instructions are specific to processor
- Limited to a set of instructions
- Harder to write and understand code
- Fast to execute
- e.g. machine code (uses binary), assembly language (use mnemonics)
9
Q
What do translators do?
A
- Translates source code written in a high level language into machine code
- Translates assembly code written in a low level language into machine code
- e.g. compiler, interpreter, assembler
10
Q
What does an Integrated Development Environment (IDE) include?
A
- Code editors to enable program code to be entered
- Error diagnostics for debugging
- Run-time environment to test and run the program
- Translator to convert high level code to machine code
11
Q
What are the editing features of an IDE?
A
- Colour coding keyword syntax and auto completing command entry
- Highlighting syntax error in code
- Automatic indentation
12
Q
What are the debugging features of an IDE?
A
- Breakpoints to stop code at a certain point
- Going through lines one at a time to check the lines being executed
- Tracing through a program to output the values of variables
13
Q
What are the two features of an IDE that provide a run-time environment?
A
- Output window
- Simulating different devices the program can run on
14
Q
What are error diagnostics?
A
- Tools provided by IDEs that give detailed feedback on errors in your code