Read on 01
Trace the executed steps
Create a small table of variables before entering a loop. Evaluate the condition, execute the body in order, and then apply the update. Include the final failed condition check so off-by-one errors become visible instead of disappearing into mental arithmetic.
For arrays and other indexed data, record both the index and the value at that index. Check the first and last legal positions. When a method returns a value, distinguish that return from any changes the method makes to an object or array.
Worked example
An integer total starts at 0. A loop adds i to total for i = 1, 2, and 3. What is the final value?
- Before the loop, total is 0.
- After the first two iterations, total becomes 1 and then 3.
- The third iteration adds 3 to the current total of 3.
The final value of total is 6.
Read on 02
Test a method against its contract
Write down what the method receives, what it must produce, and which inputs are allowed. Try a typical case, a boundary case, and a case that changes the branch taken. A program that works for one convenient example may still fail at an empty result or a boundary index.
In ScorePeak, read code in its preserved block format and use the Java quick reference beside the question when needed. Commit to a trace or written solution before opening the explanation. Free-response code is saved for self-review; the workspace does not automatically certify that a program compiles or passes every test.
Official course and exam information
The explanations and examples above are ScorePeak learning resources. For official exam structure and course scope, use these references.
From understanding to practice
Make the next session count.
Apply each method to a worked example, then try the self-check exercises and compare your reasoning with the solutions. These exercises are open without an account.