2.5 Flashcards
1
Q
What is a compiler? (2)
A
- Translates source code from high level languages into object code then into machine code
- Whole program is translated into machine code before run
2
Q
What are the advantages of a compiler? (4)
A
- No need for translation software at run-time
- Faster execution speed
- Code is optimised
- Source code is secret
3
Q
What are the disadvantages of a compiler? (3)
A
- Will not run with syntax errors (hard to debug)
- Code needs to be recompiled when the code is changed
- Designed for a specific type of processor
4
Q
What is an interpreter? (2)
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? (3)
A
- Easy to write source code, program will always run, until it finds a syntax error
- Code does not need to be recompiled when code is changed, easy to try out commands when the program has paused after finding an error
- Interpreted languages are easy for beginners to learn to write code
6
Q
What are the disadvantages of an interpreter? (4)
A
- Translation software is needed at run-time
- Slower execution speed
- Code is not optimised
- Source code is needed
7
Q
What is a high level language? (9)
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
- One source code = multiple machine code instructions
- e.g. python, java, c++
8
Q
What is machine code? (2)
A
- Uses binary
- Represents instructions in a format the CPU can decode and execute
9
Q
What is a low-level language? (8)
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
- Works on only one type of processor
- Works directly with memory
- Harder to write and understand code
- Fast to execute
- e.g. machine code, assembly language
10
Q
What do translators do? (3)
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
11
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
12
Q
What are the editing features of an IDE? (3)
A
- Illustrating keyword syntax and auto completing command entry and indentations
- Highlighting error
- Producing an output of the error message to identify it
13
Q
What are the debugging features of an IDE? (3)
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
14
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