Cambridge O Level Computer Science · Syllabus 2210 · Software
Machine Code
What is Machine Code?
Machine code consists of binary instructions from a processor's own instruction set that the CPU can execute directly. It is machine-dependent, because each type of processor has its own instruction set.
This definition is part of the Software chapter in Cambridge O Level Computer Science.
Machine Code in context
A computer is built in layers, and each layer only works because the layer beneath it is already running. Hardware executes machine instructions and nothing else. Firmware, held in non-volatile memory, starts the hardware and its bootloader loads the operating system. The operating system then manages files, memory, peripherals, users and security, and provides the platform on which application software runs. While all of that is happening, interrupts let an urgent event — a key press, a division by zero — reach the CPU without it having to keep asking. And because a CPU can only execute machine code, every program a person writes must first be put through a translator: an assembler, a compiler or an interpreter.
A high-level language is a programming language whose instructions are closer to human language than to the processor's own instruction set. Because the statements describe what should happen rather than which registers to move which bytes between, high-level code is easier to read, write and debug, and the same program will generally run on different computers — it is machine-independent. The costs are that it must be translated into machine code before a CPU can execute it, and that it gives the programmer less direct control of the hardware.
A low-level language is a programming language that is close to the processor's own machine instructions. The two forms are machine code — the binary instructions a CPU executes directly — and assembly language, which replaces those binary patterns with mnemonics. Low-level code is machine-dependent, and it is harder for people to read, write and debug; in exchange it offers direct manipulation of the hardware, including explicit control of registers and memory locations.
Assembly language is a form of low-level language that replaces the binary patterns of machine code with mnemonics — short, memorable words such as LOAD, ADD and STORE. Each assembly instruction corresponds closely to one machine operation, and registers and memory locations are referred to explicitly. Assembly language remains processor-specific, and because a CPU cannot execute a mnemonic, an assembler is needed to translate an assembly language program into machine code.
Common mistakes with Machine Code
- 7. Treating assembly language as machine code. Why it fails Assembly language uses mnemonics such as LOAD and ADD. A CPU cannot execute a mnemonic. An assembler is needed to translate assembly language into machine code. Fix "Assembly language is written for people to read; machine code is what the processor executes." See section 4.2 D.
- "Assembly language is machine code." Correct model They are different. Machine code is binary and is executed directly. Assembly language uses mnemonics and must be translated by an assembler first. They are closely related — roughly one instruction each — but they are not the same thing. Exam-safe sentence "Assembly language uses mnemonics and must be translated into machine code by an assembler."
- "An assembler translates a high-level language." Correct model An assembler translates assembly language into machine code. High-level languages are translated by a compiler or an interpreter. Exam-safe sentence "An assembler is needed to translate an assembly language program into machine code."
- M12. "High-level code is directly executed by the CPU." Why it fails If it were true there would be no reason for compilers, interpreters or assemblers to exist — and the whole of 4.2 would be unexplainable. Corrected model A CPU executes machine code and nothing else. High-level source must be translated into machine code by a compiler or an interpreter first. Exam-safe sentence "High-level language must be translated into machine code before the CPU can execute it." Show the retrieval checkHide the check Check: What is the only kind of code a CPU can execute?Answer: Machine code — binary instructions from its own instruction set.
- M13. "Machine code is portable between every CPU." Why it fails It confuses machine code with high-level source. Portability is precisely what machine code does not have; it is the defining disadvantage of the low level. Corrected model Every design of processor has its own instruction set, so machine code is machine-dependent. High-level source is machine-independent, but must still be translated for each processor. Exam-safe sentence "Machine code is machine-dependent, because each type of processor has its own instruction set." Show the retrieval checkHide the check Check: Which is machine-independent — the source code or the translated machine code?Answer: The high-level source code. The machine code produced from it is tied to one instruction set.
- M14. "Assembly language is machine code." Why it fails They are closely related but not the same. A CPU cannot execute the word LOAD; something must replace it with binary first. Corrected model Assembly language uses mnemonics and must be translated by an assembler. Machine code is the binary the CPU executes directly. The correspondence between them is close to one-to-one, which is why they are easy to confuse. Exam-safe sentence "Assembly language uses mnemonics rather than binary, and an assembler is needed to translate it into machine code." Show the retrieval checkHide the check Check: What is the one thing that has to happen to an assembly language program before it can run?Answer: It must be translated into machine code by an assembler.
- M15. "An assembler translates high-level code." Why it fails It names the wrong translator, which is a direct loss of a mark in any question that asks which translator is needed. Corrected model An assembler translates assembly language into machine code. A compiler or an interpreter translates a high-level language. Exam-safe sentence "An assembler is needed to translate an assembly language program into machine code; high-level languages are translated by a compiler or an interpreter." Show the retrieval checkHide the check Check: Match each translator to what it translates: assembler, compiler, interpreter.Answer: Assembler → assembly language. Compiler → a whole high-level program. Interpreter → a high-level program, line by line.
Questions students ask about Machine Code
What is the difference between a high-level language and a low-level language?
A high-level language uses instructions closer to human language than to a processor's own instruction set, so it is easier to read, write and debug, and is generally machine-independent — but it must be translated before a CPU can execute it and gives less direct control of the hardware. A low-level language, such as assembly language or machine code, is close to the processor's own instructions, machine-dependent and harder to read, write and debug, but allows direct manipulation of registers and memory locations.

