Revision Notes
AQA A-Level Computer Science (7517): Classification of programming languages – Revision Notes
Condensed AQA 7517 section 4.6.2 recall: low-level and high-level languages, machine code, assembly language, imperative languages and their trade-offs.
- Subject
- Computer Science
- Level
- A LEVELS
- Topic
- Fundamentals of computer systems
- Author
- Marlbridge Academic Team
- Updated
- Reviewed by
- Harris Khan (what this means)
Aligned to AQA A Level Computer Science (7517), 2015-onwards. Official specification .
Syllabus page (what it covers and how it is assessed): AQA A Level Computer Science.
Syllabus points this page covers
7517
- 4.6.2 Classification of programming languages
This page covers 1 of the 5 subtopics in topic 6, Fundamentals of computer systems.
Found an error? Report a correction.
Need help with this topic? Request a free trial class for A Level Computer Science (7517).
Condensed recall for 4.6.2 Classification of programming languages, AQA A-Level Computer Science (7517). Fuller explanations are in the classification of programming languages study guide; exam-style questions are in the classification of programming languages practice questions.
The classification
| Level | Languages | Closeness to hardware |
|---|---|---|
| Low-level | Machine code and assembly language | Close to the processor’s instruction set |
| High-level | Includes imperative high-level languages | Close to the programmer’s problem |
Development: machine code first, then assembly language (symbolic, easier for people), then high-level languages (statements translated into many machine instructions).
Machine code
- Binary instructions: an opcode (the operation) and operands (registers, values or addresses).
- The only language the processor executes directly.
- Processor-specific: each instruction set is different.
- Very difficult to read, write and debug.
Assembly language
- Mnemonics (ADD, LDR) instead of binary opcodes, plus labels.
- Roughly one assembly instruction per machine code instruction (one-to-one).
- Translated by an assembler.
- Processor-specific, not portable.
- Easier than machine code, but still hard.
LDR R0, 100 load the value at address 100 into R0
LDR R1, 101 load the value at address 101 into R1
ADD R2, R0, R1 R2 = R0 + R1
STR R2, 102 store R2 at address 102
HALT
High-level equivalent: c = a + b.
Imperative high-level language
- A program is a sequence of commands (statements) carried out in order, changing the state (variable values).
- Uses sequence, assignment, selection, iteration, and procedures and functions.
- Examples: Python, Java, C, C#, Visual Basic.
- Relationship to low-level: one high-level statement is translated into several low-level instructions by a compiler or interpreter. The structure mirrors how the processor executes instructions in sequence, changing registers and memory.
- The programmer works with variables, data types and control structures, not registers and addresses.
Comparison
| Machine code / assembly | High-level | |
|---|---|---|
| Readability | Poor | Good |
| Development time | Long | Short |
| Debugging and maintenance | Hard | Easier |
| Portability | Processor-specific | Portable |
| Hardware control | Very high | Limited |
| Size and speed of final code | Can be smallest and fastest | May be larger or slower |
| Translation | None (machine code) or assembler | Compiler or interpreter |
When low-level is the right choice
- Device drivers and parts of an operating system.
- Very small embedded systems with tiny memory.
- Time-critical routines needing exact control of timing.
- Using special processor features directly.
When high-level is the right choice
- Large applications and websites.
- Programs that must run on several types of computer.
- Projects where development time and cost matter.
Worked comparison
| Task | Choice | Reason |
|---|---|---|
| A spreadsheet application | High-level | Large, complex, needs to be portable and quick to build |
| Firmware for a tiny sensor with 512 bytes of memory | Assembly | Every byte and cycle matters |
| A device driver for a new graphics card | Low-level (or high-level with hardware access) | Direct control of hardware registers |
What one statement becomes
total = total + price in a high-level language is translated into several low-level operations:
- Load
totalfrom memory into a register. - Load
priceinto another register. - Add the registers and put the result in a register.
- Store the result in the memory location for
total.
This is the one-to-many relationship between a high-level statement and machine instructions. An assembly language program has about one instruction per machine instruction, so it is as long as the machine code.
Why portability differs
- Machine code and assembly language are written for one instruction set. Moving to a different processor means rewriting.
- A high-level program is portable because a translator for each processor produces the right machine code from the same source.
- Even high-level programs are not always portable in practice if they use features that exist only on one operating system.
Exam traps
- Machine code equals assembly. They differ: binary against mnemonics, translator needed or not.
- Assembly portable. It is processor-specific.
- High-level runs directly. It must be translated.
- High-level “runs faster”. It is faster to write.
- Imperative defined without sequence of statements or changing state.
- One-sided comparison. Give both advantages and disadvantages when asked to compare.
Key terms
| Term | Definition |
|---|---|
| Low-level language | A language close to the processor’s instruction set |
| High-level language | A language designed around the programmer’s problem, translated into machine code |
| Machine code | Binary instructions the processor can execute directly |
| Assembly language | A symbolic form of machine code using mnemonics and labels |
| Mnemonic | A short name for an instruction, such as ADD |
| Opcode | The part of an instruction that says which operation to perform |
| Imperative language | A language in which a program is a sequence of commands that change its state |
| Portable | Able to run on different types of processor with little or no change |
Self-test
- Name the two kinds of low-level language.
- What does the processor execute directly?
- What translates assembly language?
- State why assembly language is not portable.
- What is an opcode?
- What is meant by an imperative language?
- How many machine instructions might one high-level statement become?
- Give one advantage of low-level programming.
- Give one advantage of high-level programming.
- Name a task for which assembly language might be chosen.
Answers
- Machine code and assembly language.
- Machine code.
- An assembler.
- Each type of processor has its own instruction set, so the program must be rewritten for another.
- The part of a machine code instruction that specifies the operation.
- A language in which a program is a sequence of commands carried out in order, changing the state of the program.
- Usually several.
- Any one: direct control of hardware; small and fast code.
- Any one: faster to develop; easier to read and debug; portable.
- Any one: a device driver; firmware for a very small embedded system; a time-critical routine.
More resources on this topic
Related resources
-
Study guides
AQA A-Level Computer Science (7517): Hardware and software
Deeper guide to AQA 7517 section 4.6.1 Hardware and software: hardware and software, system and application software, and the role of operating systems, utilities, libraries and translators.
Computer Science · AQA · A Level
Read guide -
Practice questions
AQA A-Level Computer Science (7517): Hardware and software – Practice Questions
Original AQA 7517 section 4.6.1 questions with answers: hardware and software, system and application software, and the role of the operating system.
Computer Science · AQA · A Level
Try questions -
Revision notes
AQA A-Level Computer Science (7517): Hardware and software – Revision Notes
Condensed AQA 7517 section 4.6.1 recall: hardware, software, system and application software, and the role of operating systems, utilities, libraries and translators.
Computer Science · AQA · A Level
Revise topic
Get free revision emails (optional)
Occasional emails with practice questions, worked explanations and links to free resources for the qualification and subjects you choose. No spam, and you can unsubscribe from any email. The free tools on this site never need an email.