Software · 4 question types
Past paper frequency (2018 to 2024)
This topic accounts for approximately 4% of your exam marks.
Compiler vs interpreter differences are a recurring 3-mark question.
A is one where each instruction maps directly or very closely to a single machine-code instruction, and where the programmer has direct control over the computer's hardware (registers, memory addresses, processor instructions).
There are two low-level languages to know: and .
Machine code is the raw binary language the CPU runs directly. Every instruction is a string of 1s and 0s that matches one specific operation in the CPU's instruction set.
A machine-code instruction might look like 10110111 00000101, which is meaningless to a human reader, but the CPU can execute it without any translation step.
Assembly language is a low-level language where each binary machine-code instruction is replaced with a short, human-readable abbreviation called a .
Typical assembly mnemonics:
| Mnemonic | Meaning |
|---|---|
| LDA | Load: copy a value from memory into the accumulator |
| STA | Store: copy the accumulator's value into a memory location |
| ADD | Add a value to the accumulator |
| SUB | Subtract a value from the accumulator |
| JMP | Jump to a different instruction |
Assembly is far easier for humans to write than raw machine code, but it is still one-to-one with machine code: each assembly instruction translates to exactly one machine-code instruction.
Before assembly can run, it must be translated into machine code by a piece of software called an (covered in section 4).
Modern programmers rarely write entire programs in assembly, but low-level code is still used for specific situations:
| Advantages | Disadvantages |
|---|---|
| Direct control of memory, registers and hardware | Hard to read and write for humans |
| Efficient: small memory footprint, very fast execution | Machine-dependent: code only runs on one CPU architecture |
| Predictable timing (useful in real-time systems) | Easy to make mistakes that crash the system |
| Slow to develop compared to high-level languages |
Giving a benefit of using a low-level language
What comes up: A question asks for one advantage of writing code in a low-level language (assembly) rather than a high-level language.
Write: Any one of: (1) the programmer has direct control over the hardware (registers, memory addresses); (2) the code executes faster and uses less memory; (3) the programmer can use processor-specific instructions that are not available in a high-level language.
Watch out: Saying the code "does not need to be translated" is only partly true for assembly (it still needs an assembler); machine code alone needs no translation. Keep your answer precise about which level you mean.
| HLT | Halt the program |