🎯 Syllabus & Goals 3 min
Cambridge 4.2 · Types of programming language Paper 1 · Computer Systems
By the end of this lesson you can:
- Give the advantages and disadvantages of high-level and low-level languages.
- Describe machine code and assembly language, including mnemonics.
- Explain why a programmer might choose to write in assembly language.
Textbook: Chapter 4, §4.2.1–4.2.2 (pp. 165–168)
Recap / Warm-Up 5 min
The first half of this unit was about software that runs the computer. The second half is about how software is written and turned into something the CPU can execute. Unit 1's hexadecimal and Unit 3's accumulator both come back today.
Quick starter
Convert the binary 00010100 to denary and to hexadecimal.
Reveal the answer
16 + 4 = 20 in denary. Split into nibbles 0001 0100 → 14 in hex.
🧠 Key Concept 14 min
1 · Programs and the language ladder
A computer program is a list of instructions that lets a computer carry out a specific task. A CPU only understands its own binary language, machine code. Anything else must be translated first.
2 · High-level languages
A high-level language lets a programmer focus on the problem, with no knowledge of the CPU's instruction set. Many HLLs are portable: the same program can run on different types of computer. Examples include Python, Java, C++, Visual Basic, Pascal and Delphi.
Because statements are close to English, HLL programs are easier to read and understand, quicker to write, easier to debug, and easier to maintain. Adding two numbers is a single statement:
Cambridge pseudocode
Total ← Price + Tax
The same in Python
total = price + tax
3 · Low-level languages
Machine code
The binary instructions a CPU understands. It runs without translation. Hard for people to read, so it is usually shown in hexadecimal.
Assembly language
Uses short mnemonics such as LDA, ADD and STO in place of binary codes. Must be translated into machine code by an assembler.
Assembly language is still used, by fewer programmers, when they need to:
- make use of special hardware;
- use special machine-dependent instructions;
- write code that takes up little space in primary memory;
- write code that performs a task very quickly.

| Language | Advantages | Disadvantages |
|---|---|---|
| High-level | Independent of the type of computer · easier to read, write and understand · quicker to write · easier and quicker to debug · easier to maintain | Programs can be larger · can take longer to execute · may not be able to use special hardware |
| Low-level | Can use special hardware · includes machine-dependent instructions · code can take up little memory · code can run very quickly | Takes longer to write and debug · programs are harder to understand |
Worked Example 12 min
(a) From assembly language to machine code
A simple teaching CPU uses 12-bit instructions: a 4-bit opcode then an 8-bit address. Its opcodes are below. (This instruction set is made up for practice; real CPUs differ.)
| Mnemonic | Meaning | Opcode |
|---|---|---|
| LDA | Load the value at an address into the accumulator | 0001 |
| ADD | Add the value at an address to the accumulator | 0010 |
| STO | Store the accumulator at an address | 0011 |
The variables live at these addresses: Price = 20, Tax = 21, Total = 22. Translate:
LDA Price ADD Tax STO Total
- Look up the opcode for
LDA: 0001.Each mnemonic stands for exactly one opcode. - Convert Price's address 20 to 8-bit binary: 16 + 4 → 00010100.The address part is 8 bits wide, so pad with leading zeros.
- Join them: 0001 00010100. In hex: 1 14.Each group of 4 bits is one hex digit, which is easier to read.
ADD Tax: opcode 0010, address 21 = 00010101 → 0010 00010101 = 2 15.Same method; only the opcode and address change.STO Total: opcode 0011, address 22 = 00010110 → 0011 00010110 = 3 16.One assembly statement became one machine code instruction.
| High-level | Assembly | Machine code (binary) | Hex |
|---|---|---|---|
| Total ← Price + Tax | LDA Price | 0001 00010100 | 1 14 |
| ADD Tax | 0010 00010101 | 2 15 | |
| STO Total | 0011 00010110 | 3 16 |
What this shows: one HLL statement became several machine code instructions. One assembly statement became one machine code instruction.
(b) Which level of language should be used?
Decide for each project, with reasons.
- A school's homework-tracking website → high-level.It must be written quickly, maintained by other people, and run on many kinds of computer.
- Code to control a new camera sensor chip → low-level (assembly).It must use the chip's special hardware and machine-dependent instructions.
- A pacemaker's timing routine with 4 KiB of memory → low-level (assembly).The code must be very small and must respond very fast.
- A game for both phones and laptops → high-level.HLLs are portable — independent of the type of computer.
Try It Yourself 12 min
Goal: Name two high-level languages and the two kinds of low-level language.
Goal: Using the teaching opcodes above, translate LDA Score, ADD Bonus, STO Score with Score = 40 and Bonus = 41. Give each in binary and hex.
Goal: Explain why the Apollo guidance software was written in assembly language, while a modern space agency's website is written in high-level languages.
Hint
Compare the two computers: how much memory, how fast a response is needed, and how often the code must be changed by many people.
📝 Exam Practice 10 min
Give two advantages of writing a program in a high-level language and two advantages of writing it in a low-level language.
Mark scheme
- High-level (2), e.g. easier to read/understand · quicker to write · easier to debug · easier to maintain · portable / independent of hardware.
- Low-level (2), e.g. can use special hardware · machine-dependent instructions · uses less memory · executes faster.
Describe what is meant by assembly language.
Mark scheme
- A low-level language / dependent on the hardware (1).
- Uses mnemonics (e.g. LDA, ADD) for instructions (1).
- Must be translated into machine code by an assembler (1).
- One assembly instruction usually translates to one machine code instruction (1).
Max 3.
A programmer is writing software for a small embedded device. Explain why they might choose assembly language.
Mark scheme
- The device has little memory, and assembly code can take up less space (1).
- Assembly code can run faster / respond quickly (1).
- It can make use of the device's special hardware / machine-dependent instructions (1).
State why machine code can be executed without translation, and why it is usually displayed in hexadecimal.
Mark scheme
- It is already in binary, the language the CPU understands (1).
- Hex is shorter / easier for humans to read than long binary strings (1).
🗝️ Recap & Key Terms 3 min
High-level languages are close to English, portable and quick to write, but can be larger and slower. Low-level languages — machine code and assembly — are tied to the hardware, small and fast, but hard to write. Assembly uses mnemonics and needs an assembler.
- High-level language
- A language independent of the hardware; programs must be translated into machine code before execution.
- Low-level language
- A language dependent on the hardware; machine code and assembly language are both LLLs.
- Machine code
- A binary programming language; a machine code program can be loaded and executed without translation.
- Assembly language
- A hardware-dependent language using mnemonics; it must be translated into machine code before execution.
- Mnemonic
- A short code representing one machine instruction, e.g. LDA, ADD, STO.
Homework 1 min
Task (≤ 15 min): Compare high-level languages and low-level languages. Give two differences and state one situation where each would be the better choice. [4]
Model answer
- HLLs are independent of the hardware / portable; LLLs are machine-dependent (1).
- HLLs are easier and quicker to write, read and debug; LLLs take longer and are harder to understand (1).
- HLL is better for, e.g., a large application that must run on different computers and be maintained (1).
- LLL is better for, e.g., a device driver or embedded system needing small, fast code or special hardware (1).