Programming languages: high-level vs low-level
OCR J277 Paper 2 tests language levels and translators — usually 4–6 mark questions. Know the characteristics, advantages and disadvantages of each level, and which translator is used for each.
Levels of programming language
Machine code (level 0 — lowest level)
- Binary instructions that the CPU executes directly (no translation needed).
- Specific to a particular CPU architecture (not portable).
- Very difficult for humans to read and write.
- Used in: no modern development — only generated by compilers/assemblers.
Assembly language (low-level)
- Uses mnemonics (short abbreviations) to represent machine code instructions.
- One-to-one correspondence with machine code: one assembly instruction = one machine code instruction.
- Translated by an assembler.
- Advantages: direct hardware control; very efficient; used for device drivers, embedded systems, real-time systems.
- Disadvantages: complex; not portable (tied to CPU architecture); hard to debug.
High-level languages (e.g. Python, Java, C++, C#)
- Written in a human-readable form with English-like syntax.
- One statement can generate many machine code instructions.
- Translated by a compiler or interpreter.
- Advantages: easier to write, read and debug; portable (can run on different hardware); faster development.
- Disadvantages: slightly less efficient than hand-written assembly; less direct hardware control.
Translators
| Translator | How it works | Advantage | Disadvantage |
|---|---|---|---|
| Assembler | Converts assembly language into machine code | Direct one-to-one translation | Only for assembly language |
| Compiler | Translates the entire source code into machine code at once; produces an executable | Fast at run time (no translation needed during execution); source code protected (not distributed) | Slow compilation; errors all reported together; not interactive |
| Interpreter | Translates and executes one line at a time | Easy to debug (stops at first error); cross-platform | Slower at run time (translating each time it runs); source code must be distributed |
When to use each translator
- Compiler: production software where speed matters; distributing software without sharing source code (e.g. commercial apps).
- Interpreter: development/testing (easier debugging); scripting languages; Python in interactive mode; web browsers executing JavaScript (JIT compilation is a mix).
Common OCR exam mistakes
- Saying machine code "needs to be translated" — it does NOT. It runs directly on the CPU.
- Saying compilers are "better" than interpreters — it depends on the use case. Interpreters are better for debugging; compilers are better for production performance.
- Confusing assembler with compiler — an assembler converts assembly language (mnemonics); a compiler converts high-level language code.
- Forgetting portability: high-level languages are generally portable (can run on different hardware if a compatible interpreter/compiler exists); machine code and assembly are not portable.
AI-generated · claude-opus-4-7 · v3-ocr-computer-science