Computing · Years 5-6
Bell.Study
Writing algorithms in pseudocode
Planning programs in plain English with numbered steps before writing real code
- 1
What is pseudocode? A) A plain-English description of an algorithm B) A type of computer virus C) Code that only works on old computers D) A programming language used by Google
Answer: - 2
True or false? Pseudocode runs directly on a computer. A) True B) False
Answer: - 3
Complete the pseudocode keyword. To start a variable with a value, we write ___ score TO 0. To start a variable with a value, we write ___ score TO 0.
Answer: - 4
What is pseudocode? A) A plain-English description of an algorithm B) A computer game C) A type of computer D) A picture
Answer: - 5
Put this pseudocode in the right order to add up the numbers 1 to 5. Put these in order: OUTPUT total, SET total TO 0, REPEAT for each number from 1 to 5, SET total TO total + number, END REPEAT
Answer: - 6
Match each pseudocode keyword to what it does. Match each item on the left to one on the right. Left: SET, IF, REPEAT, OUTPUT Right: Give a variable a value, Check a condition, Do something more than once, Show something to the user
Answer: - 7
Why do programmers write pseudocode before writing real code? A) To plan the logic without worrying about programming language rules B) Because computers prefer it C) To make the program run faster D) It is the only way to test a program
Answer: - 8
Look at this pseudocode. What will it OUTPUT? SET count TO 3 REPEAT 2 TIMES SET count TO count + 1 END REPEAT OUTPUT count A) 5 B) 3 C) 6 D) 2
Answer: - 9
Put the pseudocode steps in order to find the biggest of two numbers a and b. Put these in order: INPUT a, INPUT b, IF a > b THEN, OUTPUT a, ELSE, OUTPUT b, END IF
Answer: - 10
Order this pseudocode for counting from 1 to 5. Put these in order: SET counter TO 1, REPEAT WHILE counter <= 5, OUTPUT counter, SET counter TO counter + 1, END REPEAT
Answer:
Answer key
Writing algorithms in pseudocode · for parents and teachers
- 1
A plain-English description of an algorithm
Pseudocode is a plain-English way of writing out the steps of an algorithm. It helps you plan a program before turning it into real code.
- 2
False
Pseudocode is for humans to plan with. A computer cannot run pseudocode directly. You must turn it into real code in a language like Python or Scratch first.
- 3
SET
SET is the pseudocode keyword used to give a variable a value. For example, SET score TO 0 means start score at zero.
- 4
A plain-English description of an algorithm
Pseudocode is a way to describe an algorithm in plain English, before writing real code.
- 5
SET total TO 0, REPEAT for each number from 1 to 5, SET total TO total + number, END REPEAT, OUTPUT total
First set up the variable, then loop and add, then output the result once the loop has finished.
- 6
SET → Give a variable a value; IF → Check a condition; REPEAT → Do something more than once; OUTPUT → Show something to the user
SET stores a value, IF checks a condition, REPEAT runs a loop, and OUTPUT displays the result.
- 7
To plan the logic without worrying about programming language rules
Pseudocode lets you focus on the steps of the algorithm without getting stuck on the strict rules (syntax) of a programming language.
- 8
5
count starts at 3. The loop adds 1 to count twice (3 -> 4 -> 5). OUTPUT shows 5.
- 9
INPUT a, INPUT b, IF a > b THEN, OUTPUT a, ELSE, OUTPUT b, END IF
Inputs come first so you have something to compare. The IF chooses which to OUTPUT based on which is larger.
- 10
SET counter TO 1, REPEAT WHILE counter <= 5, OUTPUT counter, SET counter TO counter + 1, END REPEAT
A counting loop sets a start, repeats while a condition is true, prints, then adds 1.