Skip to content

Computer Programming I – SS2 Digital Technologies Lesson Note (Second Term)

Download this term · ₦1,000

Lesson note at a glance

Subject
Digital Technologies
Class
SS2
Term
Second Term
Topic
Computer Programming I
Order
Topic 1 of 8 this term
Reading time
5 min

A computer program is a set of clear, step-by-step instructions that tell a computer exactly what to do.

Advertisement
  • Planning tools: programmers plan a program with algorithms, flowcharts and pseudocode before they write code.
  • Languages: the final program is written in a language such as Python or Java.
  • Logic gates: they combine ON and OFF signals inside a computer.

Behavioural objectives

By the end of the lesson, students should be able to:

  1. define a program and an algorithm;
  2. state the characteristics of a good algorithm;
  3. name the standard flowchart symbols and state what each one is used for;
  4. draw a simple flowchart from an algorithm;
  5. explain the AND, OR and NOT logic gates.

What is a program?

A program is a set of very clear, step-by-step instructions that tell a computer exactly what to do.

  • No thinking: computers cannot think for themselves.
  • Example: if you tell a computer to “make a sandwich”, it will not know where to start.
  • Programming language: a language used to write programs, such as Python or Java.
  • Planning first: we plan the instructions with algorithms and flowcharts before we write them in a language.
  • Why plan: a plan helps us find missing steps before we type any code.

What is an algorithm?

An algorithm is a step-by-step list of instructions written in plain English to solve a problem.

  • Recipe idea: if you miss a step in a cake recipe (like forgetting the eggs), the cake fails.
  • Missing steps: if you miss a step in an algorithm, the program may fail or give a wrong result.
  • Order matters: the steps must be in the right order.

Example: algorithm to cross a busy road

  1. Walk to the edge of the pavement.
  2. Look to the left.
  3. Look to the right.
  4. If a car is coming, wait and go back to Step 2.
  5. If no car is coming, walk across the road.

What are the characteristics of a good algorithm?

A good algorithm is precise, unique in its steps and finite.

Advertisement
  • Precision: every step is clear.
  • Uniqueness: there is no confusion about what to do next.
  • Finiteness: it must eventually end and not go on forever.
  • Effectiveness: each step is simple enough to be carried out.

What is a flowchart?

A flowchart is a diagram that uses different shapes to show the “flow” of an algorithm.

  • Why use it: a list of words can be hard to follow.
  • Decisions: it shows visually how a program makes decisions.

What are the standard flowchart symbols?

Flowchart shapes follow a standard, and each shape has a specific meaning.

Shape Name Purpose
Oval Start/End Where the program begins and finishes.
Parallelogram Input/Output Used when you ask the user for data (input) or show a result (output).
Rectangle Process Used for “doing” things (calculations, moving data).
Diamond Decision Used for “Yes/No” or “True/False” questions.
Arrows Flow lines They show which way the logic is moving.

How do you draw a simple flowchart?

Take the “Crossing the Road” algorithm and turn it into a flowchart in these steps.

  1. Start with an oval (Start).
  2. Use a rectangle for “Look for cars.”
  3. Use a diamond to ask: “Is a car coming?”
  4. If YES, the arrow loops back up to “Wait” and then to “Look for cars.”
  5. If NO, the arrow goes down to “Cross road.”
  6. End with an oval (End).
Start Look left and right Car coming? Wait Cross road End YES NO
Flowchart for crossing a busy road. Based on standard flowchart conventions.

What is pseudocode?

Pseudocode is a way of writing a program’s steps half in code style and half in plain English.

  • Purpose: it is the final step before typing real code.
  • No strict rules: it is not a real programming language, so a computer cannot run it.
  • Keywords: words such as INPUT, OUTPUT, IF and ELSE are often written in capital letters.
Advertisement

Example: voting age check

  1. INPUT age
  2. IF age is 18 or more THEN OUTPUT “You can Vote”
  3. ELSE OUTPUT “Too Young”

What are logic gates?

A logic gate is a circuit that combines “ON” and “OFF” signals (1 and 0) to give one result.

  • AND gate: both signals must be “ON” for the result to be “ON” (for example, you can only enter the lab if you have a key AND the teacher is present).
  • OR gate: at least one signal must be “ON” for the result to be “ON” (for example, you can pass the exam if you score high in the Test OR high in the Exam).
  • NOT gate: it flips the signal. If you put in “ON”, you get “OFF”.

What are the truth tables for the gates?

A truth table lists every possible input and the output each one gives. Here 1 means ON and 0 means OFF.

Input A Input B AND output OR output
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 1
Input NOT output
0 1
1 0

What is the difference between an algorithm, a flowchart and pseudocode?

  • Algorithm: a written list of steps in plain English.
  • Flowchart: a diagram of the steps using standard shapes.
  • Pseudocode: steps written half in code style and half in English.
Tool Format Best for…
Algorithm Written list Planning the steps in plain English.
Flowchart Visual diagram Seeing the “big picture” and the decisions.
Pseudocode Half code, half English The final step before typing real code.

Class practical activity

  1. Group work: On a piece of paper, write an algorithm for “Withdrawing money from an ATM.” (Do not forget the PIN check.)
  2. Individual task: Draw a flowchart that asks a user for their age. If they are 18 or older, display “You can Vote.” If they are younger, display “Too Young.”

Evaluation

  1. What is a program?
  2. State three characteristics of a good algorithm.
  3. Name the flowchart shape used for a decision and say what it is used for.
  4. Explain the difference between an AND gate and an OR gate, with one example of each.
  5. What is pseudocode, and when is it used?

Assignment

Draw a flowchart that combines two “Decision” diamonds. Use the correct symbols for Start/End, Input/Output, Process and Decision, and label the YES and NO arrows.

This term's Digital Technologies topics

SS2 Second Term · 8 topics

  1. Computer Programming I
  2. Computer Programming II
  3. Programming Basics
  4. Control Structure
  5. Data Science Basics
  6. Big Data and Analytics
  7. Artificial Intelligence
  8. Machine Learning Basics
Downloads

Get Digital Technologies as PDF and Word

Every week of SS2 Digital Technologies, Second Term, formatted and ready to print. Ad-free, and the copy lock comes off.

Get this term Card, bank transfer, USSD or OPay

Advertisement

Lesson Notes for Other Classes

Print it or edit it in Word

Every note is free to read online. A PDF or Word copy of one subject costs ₦1,000 for one term, or ₦2,000 for all three terms.

Sign in first, then choose your class and subject at checkout.