AQA Pseudocode Worksheet 2
AQA Pseudocode Worksheet 2
Instructions:
Complete each pseudocode snippet by filling in the missing parts. Each task includes a brief description to help you
understand the goal of the algorithm.
1. Temperature Conversion
Convert a temperature from Celsius to Fahrenheit.
counter ← 10
WHILE counter ≥ 1 DO
OUTPUT counter
counter ← counter - ________
ENDWHILE
number ← 17
IF number > 1 AND number MOD 2 ≠ 0 THEN
OUTPUT "Probably Prime"
ELSE
OUTPUT "________"
ENDIF
text ← "banana"
count ← 0
FOR i ← 0 TO LENGTH(text) - 1 DO
IF text[i] = "a" THEN
count ← count + 1
ENDIF
________ count
5. Reverse a List
Output a list in reverse order.
items ← [1, 2, 3, 4, 5]
FOR i ← LENGTH(items) - 1 TO 0 STEP -1 DO
OUTPUT ________
ENDFOR
6. Password Match Loop
Keep asking for a password until the user enters the correct one.
password ← ""
REPEAT
OUTPUT "Enter password:"
password ← USERINPUT
UNTIL password = ________
FOR i ← 1 TO 3
FOR j ← 1 TO 3
OUTPUT i * j
________
ENDFOR
grade ← "B"
IF grade = "A" THEN
OUTPUT "Excellent"
ELSEIF grade = "B" THEN
OUTPUT "________"
ELSE
OUTPUT "Needs Improvement"
ENDIF
FUNCTION add(x, y)
RETURN x + y
ENDFUNCTION