← QCE Digital Solutions Unit 3

Pseudocode for user interaction: prompts and menus

A loop that prints the options, uses a print prompt then input to read a choice, runs the matching action with if / else if, and repeats until the user picks the exit option.

Understanding Pseudocode for user interaction: prompts and menus in QCE Digital Solutions Unit 3

What it does: Each branch tests the choice value and runs the matching action, which is how a menu selects what to do. The loop shows the options, reads the choice with input and repeats until the user enters 3 to exit. print only displays the prompt. The input keyword is what stores the user's answer in a variable. The loop condition must test for the same value that the exit option uses. Otherwise the menu never ends. The else catches any choice that matched no option, so it is best used to tell the user the choice was invalid.

Common mistakes: An if statement needs the keyword then after its condition. The line should be: if age >= 18 then. Pseudocode uses the keyword input to read a value from the user, not read. The line should be: input choice.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 194–250) and word search (Modules 194–337).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which order correctly asks the user for their age in pseudocode?
print "Enter your age:" then input ageinput age then print "Enter your age:"
Matches
input choice print "Pick an option (1-3):"
↓
The input comes before the print prompt, so the user is asked for a choice after the program has already tried to read it. The prompt must be printed first.
Applying
Meanings
Term
menu loop
Meaning
A loop that prints the options, uses a print prompt then input to read a choice, runs the matching action with if / else if, and repeats until the user picks the exit option.
Practice
choice <- ""
Testing
Gaps
name
Check Answer
Spots
2input age
3if age >= 18

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Woodpecker' badge — Tap Tap Tap, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which order correctly asks the user for their age in pseudocode?
A. input age then print "Enter your age:"
B. print "Enter your age:" then input age ✓
A prompt must be printed first so the user knows what to type. Then input reads the answer into the variable.
2. What is the purpose of the print line before an input line?
A. It tells the user what to enter ✓
B. It stores the user's answer in a variable
print only displays the prompt. The input keyword is what stores the user's answer in a variable.
3. A menu loop needs to keep showing the options until the user is finished. Which structure fits best?
A. A loop that repeats until the exit option is chosen ✓
B. A single if statement that runs once
A menu must repeat so the user can do several actions. A loop with an exit condition makes this possible.
4. Which choice handling selects the matching action for a menu option?
A. if choice = 1 then ... else if choice = 2 then ... ✓
B. if choice = 1 then ... if choice = 2 then ... on the same variable inside a for loop of 1 to 1
A chain of if / else if tests the choice and runs only the matching action. Extra one-pass loops add nothing.
5. Which menu loop will stop when the user picks the exit option 3?
A. repeat ... until choice = 0 (when the exit option is 3)
B. repeat ... until choice = 3 ✓
The loop condition must test for the same value that the exit option uses. Otherwise the menu never ends.

Match the Pairs

print "Enter your age:" input age → Shows a prompt to the user, then reads their reply into the variable age.
while choice != 3 → Keeps the menu repeating until the user picks option 3, the exit option.
A menu uses if / else if to run the action that matches the user's choice. → if choice = 1 then print "Adding item" else if choice = 2 then print "Showing list" end if
A menu loop prints the options, reads a choice and repeats until the exit option is picked. → repeat print "1 Add 2 View 3 Exit" input choice until choice = 3
input choice print "Pick an option (1-3):" → The input comes before the print prompt, so the user is asked for a choice after the program has already tried to read it. The prompt must be printed first.
repeat print "1 Play 2 Quit" input choice until choice = 3 → The exit condition uses 3, but the menu only offers options 1 and 2, so the user can never exit and the loop runs forever. The condition should be choice = 2.

Key Term

menu loop
A loop that prints the options, uses a print prompt then input to read a choice, runs the matching action with if / else if, and repeats until the user picks the exit option.

Fill in the Blanks

1. print "Enter your name:" input name
Hint: Type the keyword that reads the user's reply after the prompt.
2. print "Enter a number from 1 to 3:" input num
Hint: Type the keyword that shows the prompt before the user types.
3. while choice ≠ 3 print "1 Play 2 Help 3 Exit" input choice
Hint: Type the menu number that means exit, so the loop stops when it is chosen.
4. if choice = 1 then print "Starting game" else if choice = 2 then
Hint: Type the keywords that check a second menu option when the first does not match.
5. print "Choose 1, 2 or 3:" input choice if choice = 1 then
Hint: Type the variable name that stores the user's menu pick and is tested in the next line.

Spot the Error

Question 1
A print "Enter your age:"
B input age
C if age >= 18
D print "Adult"
E end if
Line C — An if statement needs the keyword then after its condition. The line should be: if age >= 18 then
Question 2
A choice <- 0
B print "Enter choice (1-3):"
C read choice
D print "You chose " + choice
Line C — Pseudocode uses the keyword input to read a value from the user, not read. The line should be: input choice
Question 3
A print "Enter your name:"
B input <- name
C print "Hi " + name
Line B — input is followed directly by the variable that stores the typed value. No assignment arrow is used. The line should be: input name
Question 4
A choice <- 1
B while choice = 0
C print "1 Add 0 Quit"
D input choice
E end while
Line B — The menu must keep looping until the user picks the exit option, so the condition should be choice != 0. With = the loop would stop straight away, or never run properly.
Question 5
A input choice
B if choice = 1 then
C print "Playing"
D else choice = 2 then
E print "Help"
F end if
Line D — A chained selection needs the keywords else if before the next condition. The line should be: else if choice = 2 then

Student with a class code? Join your class →