CMI-2021-DataScience-A: 3
Consider the following code, in which $\text{A}$ is an array indexed from $0.$ function foo (A , n) { m = A [0] ; x = 0 ; for i = 0 to n – 1 { x = x + A [i] ; if (m < x) { m = x ; } if (x < 0) { x = 0 ; } } return (m) ; } If $\text{A}=[-12, -3, 5, 10, 8, -16, -23, 12, -5, 7]$, what will $\textsf{foo(A, 10)}$ return? $23$ $17$ $-17$ $35$
Consider the following code, in which $\text{A}$ is an array indexed from $0.$function foo (A , n) { m = A [0] ; x = 0 ; for i = 0 to n – 1 { x = x + A [i] ; if (m < x)...