35 minutes. Instant-marked. Unlimited attempts. Each answer is marked as soon as you choose it, with an explanation. Nothing is saved in this course.
P1. Which is a specification?
It states the required answer, not the method.
P2. An algorithm must be:
Finiteness and unambiguous steps are required properties.
P3. Trace “largest so far” on 2, 7, 5, 9. What is the output?
The stored value ends at 9.
P4. Trace a running total from 0 on 1, 2, 3, 4. What is the output?
1 + 2 + 3 + 4 = 10.
P5. Which test best checks a method that returns the smallest number?
A smallest item in the last position tests the whole loop.
P6. A method starts the largest at 0. For -4, -2, -9 it returns:
0 is not in the list; it is returned wrongly.
P7. What does a trace table help you do?
It exposes the real behaviour step by step.
P8. The average of an empty list is a problem because:
Division by zero is undefined.