Fiche de révision : Introduction to Computer Programming

Course Outline

  1. Computer Programming Foundations
  2. Literal Computer Behavior
  3. System and Application Programs
  4. Binary and Machine Language
  5. Three Programming Language Levels
  6. Translators and Source Code
  7. Compilation and Interpretation Paths
  8. Precise Instructions and Responsibility

1. Computer Programming Foundations

Key Concepts & Definitions

  • Computer : A machine that stores data and carries out instructions on it exactly as given.
  • Program : A complete set of instructions that tells a computer how to do one job.
  • Programmer : The person who decides what the instructions are and is answerable for what they do.
  • Instruction : One single command inside a program.

Memory Hook

Machine speed, human thinking

2. Literal Computer Behavior

★ 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

  • When a canteen program subtracts a 35-peso price from a 30-peso payment and displays −5, the machine has executed the subtraction correctly, while the programmer failed to specify what should happen when payment is insufficient.

3. System and Application Programs

Key Concepts & Definitions

  • System Program : Exists to keep the computer itself working by managing memory, files, devices, and processor sharing.
  • Application Program : Exists to do a job the user wants done, such as writing, browsing, or computing a grade.
  • Operating System : The main system program that shares memory, processor time, and files among other programs.

Essential Points

  • To classify a program, ask whether it exists primarily for the machine or for the person using it; installation source or pre-installation status does not determine the classification.

Memory Hook

Machine versus person

4. Binary and Machine Language

Key Concepts & Definitions

  • Binary : A way of writing numbers using only the digits 0 and 1.
  • Machine Language : Consists of instructions written in binary and is the only form the processor can carry out directly.
  • Bit : One binary digit, representing a single 0 or 1.

Essential Points

  • The place values in a binary number double from right to left: 1,2,4,8,16,32,1, 2, 4, 8, 16, 32, \ldots.

  • The binary number 1101 equals decimal 13 because its active place values are 8, 4, and 1.

Memory Hook

0 and 1 → binary → machine instructions

5. Three Programming Language Levels

Key Concepts & Definitions

  • Assembly Language : Expresses machine instructions as short words such as LOAD, ADD, and STORE, with one word for each machine step.
  • High-Level Language : Written for programmer convenience, with one readable line representing many machine steps.

★ Must-know

  • Machine-level code is binary and directly executable, assembly-level code uses short words for individual machine steps, and high-level code uses readable statements that require translation.

Further detail

  • Java, Python, and C are examples of high-level languages.

Memory Hook

Machine → Assembly → High-level

6. Translators and Source Code

Key Concepts & Definitions

  • Source Code : A program as the programmer writes it in a language people can read.
  • Translator : A program that turns code written in one language into another language.
  • Compiler : Translates the whole source file into machine-ready form before the program is run.
  • Interpreter : Translates and carries out source code one instruction at a time while the program is running.

Memory Hook

Whole file versus one instruction

7. Compilation and Interpretation Paths

★ 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

  • Java uses an intermediate form that is compiled once and then carried out by a program behaving like an interpreter, allowing the same program to run on Windows, macOS, and Linux without being rewritten.

Memory Hook

Source → translation → running process

8. Precise Instructions and Responsibility

★ 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

  • To fix an underpayment case, a program should first check whether the amount handed over is less than the price, display that the payment is not enough, and stop instead of subtracting.

Memory Hook

Ambiguous instruction → no exact action

Synthesis Tables

Compilation Versus Interpretation

DimensionCompilationInterpretation
Translation timingWhole source file before executionOne instruction at a time during execution
OutputSaved machine-code fileNothing saved from the translation
Startup and executionSlower startup, faster runningFaster startup, slower running
Error detectionWhole file checked before anything runsError found when the faulty line is reached

Teste tes connaissances

Teste tes connaissances sur Introduction to Computer Programming avec 11 questions à choix multiples et corrections détaillées.

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?

Faire le QCM →

Révisez avec les flashcards

Mémorisez les concepts clés de Introduction to Computer Programming avec 11 flashcards interactives.

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.

Voir les flashcards →

Cours similaires

Crée tes propres fiches de révision

Importe ton cours et l'IA génère fiches, QCM et flashcards en 30 secondes.

Générateur de fiches