Computer Science
Grade 8
20 min
What are Instructions?
What are Instructions?
Tutorial Preview
1
Introduction & Learning Objectives
Learning Objectives
Define what a computer instruction is and identify its fundamental components.
Explain the difference between high-level code and machine-level instructions.
Describe the basic steps of the Fetch-Decode-Execute cycle.
Identify common types of instructions, such as arithmetic, data transfer, and control flow.
Conceptualize how a sequence of instructions forms a program.
Understand the role of the Program Counter in instruction execution.
Have you ever wondered what really happens inside your computer when you click a button or run a program? 🤔 It all comes down to tiny, precise commands called instructions!
In this lesson, we'll dive deeper into the fundamental building blocks of all computer programs: instructions. We'll explore what they are,...
2
Key Concepts & Vocabulary
TermDefinitionExample
InstructionA single, atomic command given to the computer's central processing unit (CPU) to perform a specific operation.In a simplified view, 'ADD R1, R2' could be an instruction telling the CPU to add the contents of Register 1 and Register 2.
Instruction SetThe complete collection of all the instructions that a specific CPU can understand and execute. Each CPU architecture (like x86 or ARM) has its own unique instruction set.An Intel Core i7 processor has a different instruction set than an ARM processor found in a smartphone.
Machine CodeThe lowest-level representation of instructions, consisting of binary digits (0s and 1s) that the CPU can directly understand and execute.A machine code instruction might look like '0000000100000010' whi...
3
Core Syntax & Patterns
Instruction Format Rule
Most instructions consist of an 'opcode' (operation code) and one or more 'operands'.
The opcode tells the CPU *what* to do (e.g., add, move, jump), and the operands tell the CPU *where* to do it or *with what data* (e.g., specific registers, memory addresses, immediate values).
Sequential Execution Rule
Unless explicitly told otherwise, the CPU executes instructions in the order they appear in memory, advancing the Program Counter after each instruction.
This rule ensures that programs run predictably from start to finish. Control flow instructions (like jumps or branches) are exceptions that alter this sequential flow.
High-Level to Low-Level Translation Rule
Every high-level programming statement (like `x = y + z;`) is tra...
4 more steps in this tutorial
Sign up free to access the complete tutorial with worked examples and practice.
Sign Up Free to ContinueSample Practice Questions
Challenging
A program is compiled for a computer with an x86 architecture CPU. If you try to run that same compiled program on a computer with an ARM architecture CPU (like in most smartphones), it will not work. Why?
A.ARM CPUs are always slower than x86 CPUs, so the program times out.
B.The program's file extension (like .exe) is wrong for the ARM computer.
C.The x86 and ARM CPUs have different, incompatible instruction sets; the machine code for one is meaningless to the other.
D.The program needs to be downloaded again from the internet specifically for the ARM computer.
Challenging
Imagine a program is stuck in an infinite loop, executing the same three instructions over and over. What is the most likely behavior of the Program Counter (PC) in this scenario?
A.The PC's value stops changing and is stuck on a single address.
B.The PC's value is erased, causing the computer to crash.
C.The PC's value is cycling through the memory addresses of those three instructions (e.g., `0x100`, `0x104`, `0x108`, then a jump back to `0x100`).
D.The PC increments sequentially past the three instructions, ignoring the loop.
Challenging
A CPU fetches an instruction from memory. The instruction's binary code is `00101101`, which is a valid 'ADD' instruction. However, the CPU's internal circuitry misinterprets it as a 'SUBTRACT' instruction and performs the wrong calculation. This error would occur during which phase of the Fetch-Decode-Execute cycle?
A.The Fetch phase, because it retrieved the wrong binary code from memory.
B.The Decode phase, because the circuitry for interpreting the instruction's meaning failed.
C.The Execute phase, because the arithmetic unit is broken.
D.This is a software bug in the program, not a hardware cycle error.
Want to practice and check your answers?
Sign up to access all questions with instant feedback, explanations, and progress tracking.
Start Practicing Free