Learning: stuffing things in your head so you can pull them out later and use them.

| |
| |
| unchanged | unchanged |
| |
| |
| unchanged | different |
| |
| |
| different | different |
| |
| |
| different | different |
| |
| |
| different | different |
| |
| |
| |
| |
| different | different |
| P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | P11 | P12 | P13 | P14 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Q 1 | ||||||||||||||
| Q 2 | ||||||||||||||
| Q 3 |
Error Count non-looping code* 5 indexing exception 4 uninitialized index 3 truncated iterations 3 wrong return value 1 early termination 1 skipping elements 1 Revised program counts, except *: 5 original, 1 revised.
for (int i = 0; i ≤ a.length; i++) if (a[i] == x) ...
for (int i = 0; i < a.length - 1; i++) if (a[i] == x) ...
| This page last modified on 24 January 2010. |