Skip to main content
๐Ÿ“œ WAYPOINT LESSON

The trap taxonomy

โญโญ intermediateโณ 12 min read๐Ÿ“ Lesson 130 of 256

Eight families of wrong answers โ€” recognize the bait on sight.

The trap taxonomy โ€” every wrong answer on the exam belongs to a family. Learn the families, recognize the bait:

The < vs <= family. Loop bounds and tie-breaking. A choice that differs only by one included/excluded element is testing this.

The -1 vs 0 family. indexOf absence, sentinel defaults, "no match" conventions. What IS the contract's absence value?

The == vs .equals family. References vs content. Strings and Integers; the answer that "works" in some tests but is wrong by contract.

The copy vs alias family. x = y for objects copies the arrow. A choice assuming independent objects is bait.

The unbox family. Integer arithmetic auto-unboxes (true), Integer == Integer compares references (false for 200, true for small cached values). A choice that says "compilation error" for list.get(0) + 1 is bait.

The mutation-order family. remove/insert during forward iteration; second pass reading first pass's mutations. The choice "prints the original values" is bait.

The base-case family. Off-by-one recursion bases (0 vs 1), missing bases (StackOverflow), wrong seeds (fact(0) = 0).

The division family. Integer division truncation, 9/2 = 4, and the (double) cast that fixes it. Modulo sign on negatives (rarely tested in AP scope but the division family is everywhere).

Practicing with families converts "tricky" into "recognized".

โšก Now practice

Ready to Code
MCQ clinicTrap classification, three predictions, survivor implementation.
5 challenges ยท ยท ~55 min