Skip to main content
📜 WAYPOINT LESSON

Five patterns cover the exam

⭐⭐⭐ advanced⏳ 10 min read📍 Lesson 175 of 256

Accumulator, search-and-flag, remove-scan, two-ledger, cast-then-compute — recognize the shape, know the trap.

Pattern recognition beats re-derivation. These five patterns cover most of the exam's MCQs; when you see the shape, you already know the answer's structure:

  • Accumulator: sum += ... in a loop with a guard. Answer is the guard applied to every element. Trap options: guard applied once, guard inverted.
  • Search-and-flag: found a match, set a boolean, break. Trap: options where the flag is overwritten by a later mismatch.
  • Remove-scan: removal inside a forward loop. Trap: options assuming no shift. The survivor list is never what a no-shift reading predicts.
  • Two-ledger: static + instance fields both changing. Trap: options that read the wrong ledger.
  • Cast-then-compute vs compute-then-cast: integer division before widening. Trap: the "nice" decimal answer.

A timed set is training, not a ranking. Its job is to make these recognitions automatic under time pressure.

⚡ Now practice

Ready to Code
Speed set: 90-second drillsSix fast MCQ drills plus a careful checkpoint trace. Correctness first.
6 challenges · · ~30 min