Topics / Conditionals

Conditionals

Decisions: Boolean conditions, branches, and boundary values.

AI suggestions often look locally tidy while encoding the wrong boundary (for example > instead of >=). Conditionals are where that error hides.

Identify Terminology L1 Knowledge Atoms ~1 min

Name the part after if

What is the expression score >= 50 called in this code?

Start activity
Match Terms to Definitions L1 Knowledge Atoms ~2 min

Match the conditional vocabulary

Match each term to the definition that fits it. The code is there so you can see what each term refers to; …

Start activity
Program Tracing L2 Comprehension Relations ~2 min

Which branch runs?

What is printed?

Start activity
Modify the Code L3 Application Blocks ~3 min

A rule changes: does 65 qualify?

The pricing rule has changed: people aged 65 and over now get the senior discount (previously only people over 65 did). Modify …

Start activity
Debugging L4 Analysis Relations ~4 min

Pass mark labelled the wrong way

The intended rule is: a score of 50 or more is a pass. Identify the bug.

Start activity
Code Improvement L5 Synthesis Macro Structure ~5 min

Tidy the repeated tests

An AI generated this grading function. It gives the right answer, but it keeps re-testing conditions it already knows. Refactor it so …

Start activity
AI Suggestion Evaluation L6 Evaluation Macro Structure ~5 min

Is this leap-year check trustworthy?

Requirement: a year is a leap year if it is divisible by 4, except century years (divisible by 100), which are leap …

Start activity