Machine speed, human thinking
β Must-know
π A computer obeys literally, follows instructions in order unless told to jump, and never guesses what an unclear instruction means.
π An instruction can be carried out only when it has one single definite meaning, so phrases such as βbuy some riceβ or βcharge a fair priceβ must be made precise before a computer can act on them.
Further detail
Machine versus person
The place values in a binary number double from right to left: .
The binary number 1101 equals decimal 13 because its active place values are 8, 4, and 1.
0 and 1 β binary β machine instructions
β Must-know
Further detail
Machine β Assembly β High-level
Whole file versus one instruction
β Must-know
Compilation checks the whole source file, produces a machine-code file saved on disk, and then runs that prepared file.
Interpretation begins execution immediately and translates each instruction when it is reached during the run.
Compilation generally starts more slowly but runs faster and detects faults before execution, while interpretation starts faster but translates during execution and finds a fault only when its instruction is reached.
Further detail
Source β translation β running process
β Must-know
A programmer is responsible for every instruction a computer carries out, including instructions that were omitted for an input case.
To make an everyday instruction executable, replace vague judgments with a specific condition and a specific output, such as displaying PASSED when the grade is 75 or more and FAILED otherwise.
Further detail
Ambiguous instruction β no exact action
Compilation Versus Interpretation
| Dimension | Compilation | Interpretation |
|---|---|---|
| Translation timing | Whole source file before execution | One instruction at a time during execution |
| Output | Saved machine-code file | Nothing saved from the translation |
| Startup and execution | Slower startup, faster running | Faster startup, slower running |
| Error detection | Whole file checked before anything runs | Error found when the faulty line is reached |
Test your knowledge on Introduction to Computer Programming with 11 multiple-choice questions with detailed corrections.
1. What is the primary role of a computer in relation to data and instructions?
2. What is a computer in the context of programming?
Memorize the key concepts of Introduction to Computer Programming with 11 interactive flashcards.
What is a computer?
A machine that stores data and carries out instructions exactly as given.
Computer Definition
Machine that stores and executes instructions.
Who is a programmer?
The person who decides instructions and is answerable for their actions.
Import your course and AI generates sheets, quizzes and flashcards in 30 seconds.
Sheet generator