The GATE Grind

GATE 2025 CS (CS2) – Question 8

General Aptitude · Quantitative Aptitude: Data Interpretation, Arithmetic and Number Computation · 2 marks · Multiple choice

Which one of the following options is correct for the given data in the table?

Iteration ($i$)0123
Input ($I$)20-41015
Output ($X$)20162641
Output ($Y$)20-80-800-12000
  1. $X(i) = X(i-1) + I(i);\ Y(i) = Y(i-1)I(i);\ i > 0$
  2. $X(i) = X(i-1)I(i);\ Y(i) = Y(i-1) + I(i);\ i > 0$
  3. $X(i) = X(i-1)I(i);\ Y(i) = Y(i-1)I(i);\ i > 0$
  4. $X(i) = X(i-1) + I(i);\ Y(i) = Y(i-1)I(i-1);\ i > 0$

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

Test both recurrences at every given iteration. X is 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.

Thus for i>0,
$$X(i)=X(i-1)+I(i),\qquad Y(i)=Y(i-1)I(i).$$
Answer **A**. The multiplier must be the current input I(i), not the previous input I(i−1); at i=1 the latter would incorrectly give 20×20.

More Quantitative Aptitude: Data Interpretation, Arithmetic and Number Computation questions

All Quantitative Aptitude: Data Interpretation, Arithmetic and Number Computation questions →