DoAssignment study guide
C3.3 · Distinguish source code from machine code
Learn to distinguish source code from machine code through clear examples and targeted practice.
Ontario Grade 11 Computer Science
Computer Environments and Systems
ICS3U study topic C3.3: Recognizing two different forms of program instructions
A computer program can be represented in different forms. The instructions a person writes in a programming language are source code. Machine code is instructions encoded in a form that a computer’s processor can use. These forms are related, but they are not the same. This lesson focuses on recognizing the difference, not on the details of how a particular tool or processor works.
What you will learn
- Distinguish source code from machine code.
- Describe what each form is for and how they relate.
- Explain why a program written in a programming language is not automatically machine code.
The two forms of code
Source code is program text written using the rules of a programming language. It is a form people can read and edit. For example, in Python 3, print("Ready") is source code. Its words and punctuation have meaning according to Python’s rules.
Machine code consists of instructions encoded in a form that a computer’s processor can use. It is commonly described using bits, or 0s and 1s. But a sequence of bits shown in a lesson is not automatically a real machine-code instruction. Its meaning depends on the computer system and the role of the sequence.
The key difference is form and purpose: people work with source code in a programming language, while a processor can use machine-code instructions. Numbers, unusual symbols, or 0s and 1s alone do not prove that something is machine code.
- Source code is written in a programming language.
- Machine code is encoded instructions for a processor.
- The same program idea can be represented in different forms.
How the forms are related
A computer cannot necessarily use a programmer’s source text directly as processor instructions. Software tools can process source code so a computer can carry out a program. The tools and details vary across languages and systems; this expectation is about distinguishing the forms, not memorizing a particular translation process.
A simple conceptual model is that a person writes source code, a suitable tool processes it, and machine instructions are made available for the processor. This model shows a general relationship. It does not claim that every language follows exactly the same steps or produces a visible machine-code file.
Source code remains source code even when it is short and easy to read. Likewise, a binary-looking sequence should not be called the translation of a particular source statement unless that relationship has been established for the relevant system.
- Source code and machine code are related, but are not interchangeable names.
- The tools and steps used to process source code vary.
- Do not infer a real translation from an illustrative bit pattern.
A practical way to distinguish them
Ask what form you are looking at and what it is intended for. A statement written using a language such as Python is source code. Encoded instructions for a processor are machine code. Appearance alone may not settle the question, so consider the context: which language is named, and what role does the information have?
For a short program, the input-process-output idea can clarify what is being discussed. The input to the example can be the source text a programmer writes. A suitable tool processes it. The important distinction is between that readable source and processor instructions; this lesson does not assume a specific tool or show a real translation.
The example uses Python 3 because its source is easy to recognize. Other classrooms may use other programming languages, with different-looking source syntax. The distinction between source code and machine code still applies.
- Identify the programming language and the purpose of the representation.
- Programming-language statements are source code.
- Processor-encoded instructions are machine code.
Use the distinction carefully
Do not confuse a program’s purpose with its representation. The idea of displaying a message is not itself source code or machine code. A Python statement that expresses the idea is source code; encoded instructions for a processor are a different form.
Avoid claiming that a particular sequence of bits is the machine-code result of a Python statement unless there is evidence for that claim. The actual instructions depend on the computer system and how the source is processed. Without that context, a made-up bit pattern is only an illustration, not a verified translation.
A clear explanation names both forms and their roles. For example: “This is Python source code because it uses Python syntax; machine code is encoded instruction information for a processor.”
- Separate a program’s purpose from the form used to represent it.
- Do not claim a specific translation without evidence.
- A comparison should name both forms and their intended roles.
Trace of the Python source line
| Stage | Information |
|---|---|
| Input | No external input |
| Source line | print("Ready") |
| Text selected for display | Ready |
| Expected output | Ready |
Worked example
Recognizing Python source code
A student sees the line print("Ready") in a Python 3 lesson. Identify its form, state its input, and determine the expected displayed output by reading the line.
Python 3
print("Ready")- Identify the formThis is Python 3 source code: it uses Python syntax and makes a call to the print function. It is not machine code merely because a computer can process it.
- Trace the lineThere is no external input. The text inside the quotation marks is Ready, so the print call displays that text.
Answer: The line is Python 3 source code. With no external input, its expected displayed output is Ready.
Check: The expected output is derived by reading the source line; the code is not claimed to have been executed.
Worked example
Following the relationship between forms
A class diagram shows a programmer’s source text being processed by a suitable tool, with processor instructions made available afterward. Which part is source code, and which part represents machine code?
Conceptual view only; tools and exact steps vary.
- Name the starting formThe programmer’s text, written in a programming language, is source code. It is the form people can read and edit using that language’s rules.
- Name the processor formThe encoded instructions made available for the processor are machine code. The diagram shows a general relationship, not the exact steps used by every language or system.
Answer: The programmer’s programming-language text is source code; the processor-encoded instructions are machine code.
Check: The diagram gives a general relationship and does not claim a particular tool or translation method.
Worked example
Avoiding a misleading bit-pattern claim
A worksheet shows a row of 0s and 1s beside a Python statement and calls it “the machine code for that statement.” What can you conclude from the information given?
- Recognize the sourceThe Python statement is source code because it is written using Python syntax.
- Check the evidence for the claimA row of 0s and 1s may be an illustration, but the worksheet gives no information about the relevant computer system or how the source was processed. You cannot verify that the row is the machine-code form of the statement.
Answer: The Python statement is source code. The bit pattern cannot be confirmed as its machine-code translation from the information given.
Check: This avoids treating every binary-looking sequence as verified machine code for a particular program.
Common mistakes and how to avoid them
Calling any string of 0s and 1s machine code.
Correction: A bit pattern is not confirmed as machine code for a program unless its role and context are known.
Calling Python source code machine code because a computer can process it.
Correction: Python statements are source code; machine code refers to instructions encoded for a processor.
Assuming every language uses the same translation steps.
Correction: Tools and details vary. Focus on distinguishing source code from machine code.
Lesson summary
- Source code is program text written using a programming language.
- Machine code is encoded instruction information for a processor.
- A suitable tool may process source code so a computer can carry out a program, but the details vary.
- Do not claim an illustrative bit pattern is the verified machine-code translation of a source statement.
Check your understanding
Question 1
A statement written with Python syntax is best identified as which form?
- Source code
- Machine code
- A processor
- A guaranteed binary translation
Show answer and explanation
Source code
Python syntax is a programming-language form, so a Python statement is source code.
Question 2
Which description best fits machine code?
- Any instructions written in English
- Instructions encoded in a form a processor can use
- Every program before it is saved
- A programming language’s comments
Show answer and explanation
Instructions encoded in a form a processor can use
Machine code is encoded instruction information for a processor.
Question 3
A page pairs a source statement with an unexplained sequence of bits. What is the most careful conclusion?
- The bits must be the exact machine code for the statement.
- The source statement is machine code because bits are shown nearby.
- The statement can be identified as source code, but the bit sequence is not verified as its translation.
- Source code and machine code always have identical appearance.
Show answer and explanation
The statement can be identified as source code, but the bit sequence is not verified as its translation.
The statement’s programming-language syntax identifies it as source code. Without relevant context, the bit sequence cannot be verified as its machine-code translation.
Key terms
- Source code
- Program text written using the rules of a programming language.
- Machine code
- Instructions encoded in a form that a computer’s processor can use.
- Processor
- A computer component that carries out instructions.
Continue through ICS3U
View the complete ICS3U Ontario Grade 11 Computer Science curriculum and lessons
- C3.2 · Use documentation to build a working program
- C3.4 · Compare an interpreter and a compiler
- C1.1 · Match internal computer components to user needs
- C1.2 · Interpret processor, memory, and storage specifications
- C1.3 · Select peripherals for a user task
- C1.4 · Relate programming operations to hardware components
About this lesson and its review
Published by DoAssignment. This reviewed lesson follows Ontario Grade 11 Computer Science (ICS3U), expectation C3.3. It is a study resource, not an official curriculum publication.
Before publication, content is checked for structure, mathematical or chemical notation, calculations, course boundaries, and readability. Errors can still occur, so corrections are welcomed.