GATE 2025 CS (CS2) – Question 8
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 |
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (A) $X(i) = X(i-1) + I(i);\ Y(i) = Y(i-1)I(i);\ i > 0$
Explanation
X accumulates a running sum: 20-4=16, 16+10=26, 26+15=41. Y is a running product: 20×(-4)=-80, -80×10=-800, -800×15=-12000.