GCSE · Computer Science · Eduqas · Spec C500QS
Selection
Same program, different input, different route. The code never changes, so what makes the program go one way instead of the other?
Computer Science · Selection
Same program, different route
Pick a run. At each marked step, call what goes in the outcome column before the trace table shows it. All the scores are made up.
INPUT scoreIF score >= 90 THENOUTPUT "Top score!"END IFIF score >= 50 THENOUTPUT "Pass"ELSEOUTPUT "Retry"END IFOUTPUT "Done"
| score | outcome |
|---|---|
| 95 |
Step 1. Run 1 starts. The made-up score 95 is stored in score. This first step is already worked out for you.
Work out the test with this run's score, then check the outcome column.
Computer Science · Conditions
Could this go after IF?
Sort each made-up line: could it be the condition after IF, or not?
Still to sort
A condition (0)
Works out to true or false
Where the line is: Ask yourself: could this ever give an answer other than true or false?
Not a condition (0)
Gives a value or does a job
Where the line is: A number, some text or an instruction is not a test, even if it sits near one.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
How a program decides which path to take.
What you need to know
- Selection means the program tests a condition, and the result decides which instructions run next.
- A condition is a Boolean expression: it works out to true or false, nothing else.
- IF ... THEN runs its block only when the condition is true.
- When the condition is false, the block is skipped and the program carries on after the structure.
Have a goSam says: "The condition came out false, so the whole program just stops dead." Is Sam right about what happens next?
No. The block is skipped and the program carries on after the structure.
A false IF ... THEN only skips its own block. Everything after the structure still runs.
- Add ELSE and the THEN block runs for true, the ELSE block for false: exactly one block runs.
Have a goA made-up program says IF age >= 12 THEN OUTPUT "Older" ELSE OUTPUT "Younger". Age is 9. Which block runs, THEN or ELSE?
ELSE, so Younger is output.
9 >= 12 is false, so the THEN block is skipped. It is not a case of both blocks running.
- ELSE IF tests conditions in order. The first true one runs its block and the rest are not tested.
- An optional final ELSE runs only when none of the conditions is true.
Have a goA chain tests score >= 90, then score >= 70, then has a final ELSE. The score is 95. How many of the conditions get tested?
One: score >= 90 is true, so its block runs and the others are not tested.
ELSE IF stops at the first true condition. It does not keep testing just because later conditions would also be true.
- Selection can be nested: an inner selection is only tested if execution reaches its branch.
- In a flowchart, a diamond holds the condition, with one exit for true (Yes) and one for false (No).
- A trace table records each condition's outcome and each variable's value as you follow the path.
The big picture
Selection lets a program choose. It tests a condition, which is a Boolean expression so it is either true or false, and the result decides which block runs next. IF ... THEN skips its block when the condition is false, IF ... THEN ... ELSE always runs exactly one block, ELSE IF takes the first true condition, and selections can be nested inside each other. A flowchart shows the decision as a diamond with Yes and No exits, and a trace table records each condition's outcome as you follow the path.
Key points
Worked example
Problem
A made-up ticket program: INPUT age. IF age < 16 THEN SET price TO 4 ELSE SET price TO 8 END IF. OUTPUT price. What price is printed for someone aged exactly 16?
⚠ Watch out
Thinking a false condition stops the program, or that every block runs. A false IF ... THEN only skips its own block, and in IF ... THEN ... ELSE and ELSE IF only one block runs.
Memory hook
Test it, then take one road: the condition picks the path, and in an ELSE IF chain the first true test in the written order wins.
Check yourself
A made-up program says IF score >= 50 THEN OUTPUT "Pass" ELSE OUTPUT "Retry", then OUTPUT "Done". The score is 49. Without looking back, say what is printed, in order, and which block was skipped.
Flashcards
(11)What is selection in a program?
What kind of expression is the condition in selection?
When does the block in IF ... THEN run?
What happens after a false IF ... THEN condition?
How many blocks run in IF ... THEN ... ELSE?
How does an ELSE IF chain choose a block?
When does the final ELSE in an ELSE IF chain run?
When is a nested (inner) selection tested?
What does a decision diamond in a flowchart hold, and how does it exit?
What does a trace table record for a selection?
What decides which block runs when a program reaches a selection?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore Eduqas GCSE Computer Science topics
How this lesson was checked. This Eduqas GCSE Computer Science (specification C500QS)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 28 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.