Exam preparation · GCSE · about 15 min
Reading and writing exam pseudocode and flowcharts, and translating both ways.
[1 mark]How many times does FOR i = 1 TO 5 run?
[1 mark]Which pseudocode keyword prints something?
[1 mark]In a flowchart, what does a diamond mean?
[1 mark]What does this program print?
for i in range(1, 4):
print(i * i)[1 mark]You are asked to write an algorithm. What may you use?
Turn the pseudocode in the comment into a working program. It asks for a number of steps, drives that many 10 cm steps while counting the total distance, and prints the total. input() is answered for you with 4.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect() # steps = USERINPUT # total = 0 # FOR i = 1 TO steps # MOVE FORWARD 10 # total = total + 10 # OUTPUT "step " + i + ": " + total # NEXT i # OUTPUT "total: " + total
Plan your program here, then type it in and press Run.
WHILE loop in pseudocode, then in Python.