📁 Paper 2 · 3.4 Computer Systems
3.4.5b Assemblers, Bytecode & Language Levels
AQA 8525 · GCSE Computer Science · ~9 min read
Notes
──
Video
──
Worksheet
──
Quiz

Levels of Programming Language

Programming languages exist on a spectrum from low-level (close to machine code) to high-level (close to human language). Each level requires a different type of translator.

Machine Code
Binary (1s and 0s). Directly executed by the CPU. No translation needed. Hardware-specific — not portable. Extremely difficult to write and read. Example: 10110000 01100001
Assembly Language
Uses mnemonics — short text codes that map directly to machine code instructions. One instruction = one machine code instruction. Translated by an assembler. Still hardware-specific. Examples: MOV, ADD, JMP, CMP, INT.
High-Level Language
English-like syntax, abstracts hardware. One line = many machine code instructions. Portable across platforms. Translated by a compiler or interpreter. Examples: Python, Java, C#, JavaScript, C++.

Assembler

An assembler is a translator that converts assembly language (low-level) into machine code. It is a 1-to-1 translation — each assembly mnemonic maps to exactly one binary machine code instruction.

; Assembly (x86) — add two numbers
MOV AX, 5 ; load 5 into register AX
MOV BX, 3 ; load 3 into register BX
ADD AX, BX ; AX = AX + BX (result: 8)
INT 21h ; call OS interrupt

Assembly language is still used today for device drivers, embedded systems, and performance-critical code where direct hardware control is needed. However, it is very hard to write and maintain.

Bytecode and the JVM (Java)

Some languages — particularly Java — use an intermediate approach. Rather than compiling directly to machine code or interpreting the source line-by-line, Java compiles to bytecode.

Bytecode is not machine code for any specific CPU. It is a compact, intermediate binary format designed to be run by a Virtual Machine (VM).

Java source
(.java file)
javac
(compiler)
Bytecode
(.class file)
JVM
(interpreter/JIT)
CPU executes

The Java Virtual Machine (JVM) is installed on each platform (Windows, macOS, Linux) and runs the same .class bytecode file. This is the basis of Java's famous "Write Once, Run Anywhere" principle.

⚡ JIT — Just-In-Time Compilation

Modern JVMs use Just-In-Time (JIT) compilation. The JVM identifies "hot" code paths (frequently executed sections) and compiles them to native machine code at runtime, caching the result. This combines the portability of interpretation with performance closer to compilation.

Comparison — All Translator Types

TranslatorInputOutputUsed for
AssemblerAssembly languageMachine codeLow-level/hardware programming
CompilerHigh-level languageExecutable/machine codeFast production software (C, C++, C#)
InterpreterHigh-level languageNo file — runs directlyScripting, education, rapid dev (Python)
JIT CompilerBytecodeNative machine code (cached)Java, JavaScript (V8 engine), .NET

Advantages and Disadvantages of Assembly Language

AdvantageDisadvantage
Direct hardware control — very efficient and fastVery hard and time-consuming to write
Smaller executable size — no abstraction overheadHardware-specific — not portable between CPU types
Can access CPU registers and memory directlyNo built-in error checking — bugs are hard to find
Used in embedded systems where resources are very limitedRequires deep knowledge of the specific CPU architecture
Exam tip: The AQA spec requires you to know assembler as a translator type alongside compiler and interpreter. Know that assembler converts assembly language to machine code (1-to-1), and know that bytecode is an intermediate form. The key Java point: "write once, run anywhere" — the JVM on each platform runs the same bytecode.
⚠️ Common Mistakes
  • Confusing machine code with assembly language — machine code is binary; assembly uses mnemonics like MOV and ADD
  • Saying "assembly is the same as machine code" — it is not; it still needs the assembler to translate it
  • Saying bytecode is machine code — bytecode is an INTERMEDIATE format, not native machine code; it needs the JVM
Video coming soon

Key points

  • Three levels: machine code (binary, runs on CPU), assembly language (mnemonics, translated by assembler), high-level (English-like, compiled or interpreted)
  • Assembler: 1-to-1 translation of assembly mnemonics to machine code
  • Java: source → compiler → bytecode (.class) → JVM → executes; "write once, run anywhere"
  • JIT compilation: translates bytecode to native machine code at runtime for performance
Click slide or press arrow keys to navigate
✍️

Worksheet — 3.4.5b Assemblers & Bytecode

8 questions · 19 marks

Q1What is an assembler? How does it differ from a compiler?[2]
✅ Mark scheme
Mark scheme
An assembler translates assembly language (mnemonics) into machine code [1]; unlike a compiler (which translates a high-level language), an assembler performs a 1-to-1 translation — each assembly instruction maps to exactly one machine code instruction [1].
Q2What is assembly language? Give two characteristics of assembly language.[3]
✅ Mark scheme
Mark scheme
Assembly language is a low-level programming language that uses mnemonics (short text codes) to represent CPU instructions [1]; characteristics (any two): each instruction corresponds to one machine code instruction [1]; hardware-specific — programs written for one CPU type will not run on a different CPU without rewriting [1]; gives direct access to CPU registers and memory [1].
Q3What is bytecode? How is it different from machine code?[2]
✅ Mark scheme
Mark scheme
Bytecode is an intermediate compiled format produced by a compiler but NOT directly executable by a CPU [1]; machine code is binary instructions executed directly by the CPU, while bytecode must be interpreted or JIT-compiled by a Virtual Machine (e.g. JVM) at runtime [1].
Q4Describe how Java code is translated and executed, mentioning the stages from source code to execution.[3]
✅ Mark scheme
Mark scheme
Java source code (.java) is compiled by the Java compiler (javac) into bytecode (.class file) [1]; the bytecode is platform-independent — it is not machine code for any specific CPU [1]; the Java Virtual Machine (JVM), installed on each platform, runs the bytecode (interpreting or JIT-compiling it to native machine code) [1].
Q5Explain the phrase "Write Once, Run Anywhere" in the context of Java.[2]
✅ Mark scheme
Mark scheme
Java compiles to bytecode, which is not specific to any hardware or OS [1]; any machine with a JVM installed can run the same .class file — so the programmer writes the code once and it runs on any platform without rewriting [1].
Q6Give two advantages of using assembly language over machine code.[2]
✅ Mark scheme
Mark scheme
Any two: assembly uses mnemonics (like MOV, ADD) which are easier to read and remember than binary [1]; assembly programs can include comments, making them slightly easier to understand [1]; the assembler automatically handles converting mnemonics to binary, reducing errors compared to writing binary directly [1].
Q7What is JIT (Just-In-Time) compilation? State one advantage.[2]
✅ Mark scheme
Mark scheme
JIT compilation translates bytecode into native machine code at runtime, caching the compiled code for reuse [1]; advantage: combines the portability of bytecode with execution speeds closer to fully compiled code [1].
Q8A manufacturer designs a new microprocessor chip. Explain whether software written in assembly language for an older chip would work on this new chip.[3]
✅ Mark scheme
Mark scheme
Assembly language is hardware-specific [1]; if the new chip has a different instruction set/architecture, the assembly code would NOT work and would need to be completely rewritten for the new chip [1]; this is a major disadvantage of assembly language compared to high-level languages which are portable — a Python or Java program could be recompiled/re-interpreted for the new chip [1].
Check your answers above.
Topic Quiz
Q 1 of 10
You scored
out of 10
Card 1 of 6
Click to flip
🎉
All done!
TermDefinition
🎯

Mini Test — 3.4.5b Assemblers & Bytecode

Timed exam conditions.

  • 8 questions · 10 minutes
  • 5 MCQ + 3 short answer
← 3.4.5a Translators
41 of 57 · AQA 8525
3.5a Network Types →