Activity 01
Think-Pair-Share: Spot the Bug
Provide a pseudocode algorithm with a planted logic error (an off-by-one condition or a flipped comparison operator). Students individually identify what they think is wrong, then compare findings with a partner and build consensus before the class discusses the correct diagnosis.
Explain various ways logic errors can be identified before code is even written.
Facilitation TipDuring Think-Pair-Share: Spot the Bug, circulate and listen for students describing the algorithm’s intended behavior before they look for mistakes.
What to look forPresent students with a simple pseudocode algorithm designed to calculate the average of three numbers, but with a logic error (e.g., dividing by 2 instead of 3). Ask: 'What is the expected output for inputs 10, 20, 30? What is the actual output of this algorithm? Identify the specific line causing the logic error.'