Study guide: Choose, Count and Test Decisions
Apply a condition, repeat it across items and test both branches of a rule.
Ideas to explain in your own words
- Choose one branch of an algorithm by checking a stated condition.
- Evaluate an inclusive threshold and execute exactly one branch.
- Combine a repeat over cards with a conditional count.
- Choose cases that exercise both branches and find a reversed action.
Watch your reasoning
- The condition asks whether the card has a star. This card has only a triangle, so the condition is false and the otherwise branch sends it to B.
- 5 is greater than 4, so the condition is true and only ready is written.
- The running counts are 0, 1, 2, 2. Exactly two cards meet the star condition.
- Only a card with a dot reaches the incorrect true branch. A blank card exercises the already-correct else branch.
A worked review example
Follow an If/Else Rule: A green card with a star goes to A. A green card with no star goes to B. Being green does not change the rule. Choose a Branch with a Number: Rows: 3 | false | wait; 4 | true | ready; 6 | true | ready. No row prints both ready and wait. Count Items That Match a Rule: Counts after the five cards are 1, 1, 2, 2, 3. The final result is 3 matching cards, even though 5 cards were visited. Test Both Sides of a Decision: Before repair: dot card expected D, actual N, fail; blank card expected N, actual N, pass. After repair, the dot card gives D and the blank card gives N: both tests pass.
Make a practice plan
- Try the supplied lesson problems without looking at the answers.
- Compare your method with the worked examples and explain any correction.
- Use the new review cases, then complete the transfer task on paper or in your own document.