Which one of the following options is correct for the given data in the table?
| Iteration (\(i\)) | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| Input (\(I\)) | 20 | −4 | 10 | 15 |
| Output (\(X\)) | 20 | 16 | 26 | 41 |
| Output (\(Y\)) | 20 | −80 | −800 | −12000 |
Answer
(A)
Explanation
Test the first step, \(i = 1\), where \(I(1) = -4\):
- \(X\): \(20 + (-4) = 16\) matches, while \(20 \times (-4) = -80\) does not, so \(X\) is a running sum. This rules out B and C.
- \(Y\): \(20 \times (-4) = -80\) matches, so \(Y\) is multiplied by the current input. D would give \(20 \times 20 = 400\) instead.
The rule in A also fits the later columns: \(16 + 10 = 26\), \(26 + 15 = 41\), \(-80 \times 10 = -800\) and \(-800 \times 15 = -12000\).
Answer: A