Computer Science Grade 7 20 min

What is an Algorithm?

Understand that an algorithm is a set of instructions.

Tutorial Preview

1

Introduction & Learning Objectives

Learning Objectives Define the term 'algorithm' in their own words using everyday examples. Identify the sequence of steps in a given real-world task, like a recipe or game instructions. Write a simple, clear algorithm for a common problem with at least 5 steps. Explain why the order and clarity of steps are critical for an algorithm to work correctly. Differentiate between an algorithm (the instructions) and the final result (the outcome). Recognize that computers need extremely precise algorithms to perform tasks. Have you ever followed a recipe to bake cookies or a tutorial to beat a video game level? 🍪🎮 You were using an algorithm! In this chapter, we'll discover that an algorithm is just a fancy word for a set of step-by-step instructions to solve a pr...
2

Key Concepts & Vocabulary

TermDefinitionExample AlgorithmA list of clear, ordered steps to follow to complete a task or solve a problem.A recipe for baking a cake is an algorithm. If you follow the steps in order, you get a cake. SequenceThe specific order in which steps are performed in an algorithm.In the algorithm for tying your shoes, you must make the loops *before* you cross them over. InstructionA single, specific action or step within an algorithm.In a recipe, 'Add 2 cups of flour' is one instruction. InputThe information or materials you start with before running an algorithm.For a cake recipe algorithm, the inputs are the ingredients: flour, sugar, eggs, etc. OutputThe result or solution you get after completing all the steps of an algorithm.For a cake recipe algorithm, the output is the finish...
3

Core Syntax & Patterns

Rule 1: Be Precise Every step must be clear and unambiguous. An algorithm must have instructions that are so clear, there's no way to misunderstand them. A computer can't guess what you mean, so 'add some sugar' is bad, but 'add 1 cup of sugar' is good. Rule 2: Correct Order Matters The sequence of steps must be logical and correct. The order of instructions is critical. You must put on your socks before your shoes. A computer follows instructions in the exact order you give them, so a mistake in the sequence will lead to the wrong result. Rule 3: It Must End An algorithm must have a finite number of steps and a clear stopping point. An algorithm can't go on forever. It needs to have a defined end, which usually happens when the pro...

4 more steps in this tutorial

Sign up free to access the complete tutorial with worked examples and practice.

Sign Up Free to Continue

Sample Practice Questions

Challenging
An algorithm for a robot to clean a room is: 1. Pick up trash. 2. Put things away. 3. Vacuum the floor. Why is this algorithm likely to fail?
A.The sequence is wrong; it should vacuum first.
B.The algorithm has too many steps.
C.The instructions 'pick up trash' and 'put things away' are too vague and don't specify where or how.
D.The robot might not have a vacuum.
Challenging
An algorithm for a game character is: 1. If enemy is near, attack. 2. If health is low, find a health pack. 3. Move toward the goal. A character has low health and is near an enemy. What is the logical flaw?
A.The character will get stuck in a loop, doing nothing.
B.The character will ignore the enemy and look for health.
C.The character will ignore its low health and attack the enemy.
D.The algorithm doesn't specify what to do if both conditions are true, leading to a conflict.
Challenging
You are designing an algorithm for a robot to pour a glass of juice. The inputs are a carton of juice, a glass, and a table. Which set of instructions best demonstrates precision and correct sequencing?
A.1. Get juice. 2. Pour juice. 3. Put glass on table.
B.1. Place glass on table. 2. Pick up juice carton. 3. Open juice carton. 4. Pour juice into glass until glass is 90% full. 5. Close juice carton.
C.1. Pour juice into glass. 2. Place glass on table. 3. Find juice carton.
D.1. Put everything on the table. 2. Pour some juice.

Want to practice and check your answers?

Sign up to access all questions with instant feedback, explanations, and progress tracking.

Start Practicing Free

More from Chapter 1: The Magic of Algorithms: From Everyday Life to Computer Code

Ready to find your learning gaps?

Take a free diagnostic test and get a personalized learning plan in minutes.