P2 T2 L3 Programming Language Classification Flashcards
What is machine code? (2 points)
- Lowest level – works at the level of the machine, consists of binary numbers for both opcodes and operands
Opcode: operation code / instruction
Operand: either data or memory address where data is held
- In machine code, a typical instruction holds an operation code (opcode) in the first few bits and an operand in the rest of the bits
What is an instruction set? (1 point)
- The instruction set is all the instructions that the computer can understand and execute
What is assembly language? (2 points)
In assembly language, what were the two major improvements? (2 improvements) (compared to writing in machine code)
The next stage in the development of programming languages was assembly language
- A way of writing programs using mnemonics
- one-to-one relationship between assembly language and machine code instructions
This featured two major improvements:
- Each opcode was replaced by a mnemonic (short written code) which gave a clue as to what the operation did
- The operand was replaced by a decimal (or hexadecimal) number
What advantages did assembly code bring to programmers? (1 point)
- easier for humans to write, understand and debug programs in assembly language
What disadvantages did assembly code bring to programmers? (1 point)
- assembly code has to be translated into machine code by an assembler
What is an imperative high-level language? (2 points)
- An imperative high-level language consists of a series of commands for the computer to perform – the programmer uses the language to describe how a problem is solved
- This is in contrast to a declarative language which focuses on what the program should do without listing the steps needed to achieve the result eg SQL or ProLog
Why do people program in high-level? (1 point)
- Programmer can think and code in terms of algorithms
This is an example of abstraction
How are high-level language statements translated into machine code? (2 points)
- HLL program has to be converted into machine code before it can be executed
- Each HLL command represents several AL / commands
Advantages of high-level vs low-level languages (3 advantages)
- Much easier and faster to write, debug and maintain programs
- Different high-level languages have been written specifically for different types of problem
- High-level language programs are portable – a program written for one type of computer can be recompiled for a different type of computer
Disadvantages of high-level vs low-level languages (3 disadvantages)
- The object code (compiled or interpreted code) may run slower than assembly code or machine code
- The object code may occupy more space in RAM – which can be a problem in embedded systems with a small amount of memory
- Most high-level languages do not have statements to allow the programmer to manipulate individual bits – essential in some applications, e.g. device drivers
Are machine-code and assembly language high-level languages or low-level languages?
low-level languages