4.6 Computer Systems Flashcards
What are low level languages?
They are specific to the type of processor they are written for and directly affect the computers processor - very similar to the instruction set of the computer
What is machine code?
Machine code uses the binary digits 1 and 0 to represent instructions so they directly manipulate the processor
What are the advantages of using machine code?
Programmers are not constrained when using machine code and there is no need to translate it before executing it so its useful for embedded systems and real time applications
What are the disadvantages of using machine code
Very long and extremely difficult for humans to understand so its prone to errors and difficult to debug - also not portably as it is processor specific
What is assembly language
Simplifies machine code by using mnemonics instead of binary instructions so it has a 1-1 correlation to machine code instructions
what are the advantages of assembly language over using machine code
More compact and less prone to errors than machine code as mnemonics help make the code easier for humans to understand so debugging is easier and translation to machine code is quick
What are the disadvantages of assembly language
Not portable as the program is processor specific - the debugging is more difficult then high-level languages and an assembler still has to be used to translate the program
What is a situation when you would use low-level languages
When coding for execution speed and when coding for a specific processor
What are high level languages
They are non-platform specific languages that use English instructions and mathematical symbols
What are advantages of using high-level language
Code is easier to understand,mantain and debug - faster development time - programs are more portable to other hardier platforms as they are not processor specific
What are disadvantages of high-level languages compared to low level languages
Low level languages may execute code quicker - may use more memory them low level languages - low level languages have more direct access to computer hardware
State four reasons that high level language programs are easier to understand
Use of indentation to separate statement blocks, use of comments to annotate the program, use of procedures/functions, use of constants
Explain the term imperative in context to high-level languages
Instructions are executed in programmer defined order - imperative languages describe now to solve a problem in terms of sequences of actions to be taken
Why are there so many high level programming languages
Languages used for a specific problem type
What is a compiler
A compiler translates high level languages by translating the whole source code at once, it will not produce an executable file if an error is encountered, it produces object code, you do not need the compiler to execute a compiled program, compiled code can only be executed on a machine with the same processor type
What is an interpreter
An interpreter translates high-level languages by analysing source code line by line, it will debug and execute each line until the end or the first error, interpreter and source code must always be present
What is an assembler
A translator that translates assembly language into machine code it is very quick and straightforward due to the 1-1 relationship - but they are platform specific
What is the input and output for a translator called
Input is source code and output is object code
How do compilers that use intermediate languages work
They translate the source code into an intermediate language (often bytecode) which allows for platform independence, it then uses a virtual machine to execute the bytecode on different processors - allows source code to only be translated once but translated code can be executed with a variety of different processors
Why would interpreters be used instead of compilers
If you don’t know what type of processor will be in the user’s computer - a compiled program will only execute on a processor of a specific type
Describe a half adder
It has two inputs and two outputs - sum and carry bit, used to add two Boolean values
Describe a full adder circuit
It describes a full adder circuit has three inputs and two outputs - enables it to input two Boolean value and a carry bit from Describe a full adder circuit a previous operation - it outputs the sum and a carry bit
Boolean identities common laws to simplify these
1) A+B.C
2) A.(A+B)
1) A+B.C = (A+B).(A+C)
2) A.(A+B) = A
Describe de mogan’s law in words
Break the not and switch signs