1.

The result of cumsum([1,2,3]) and sum([3,3]) are ____________(a) Same(b) Different(c) Absolute numbers(d) Signed numbersThe question was posed to me in an online interview.I want to ask this question from Sums and Products in chapter Beyond the Basics of MATLAB

Answer»

Right option is (b) Different

The best I can explain: The result of cumsum([1 2 3]) is 1,3,6 i.e the result is a row vector having output after ADDING up each element CUMULATIVELY while the result of sum([3 3]) is only 6. Hence, the two ANSWERS are different.



Discussion

No Comment Found

Related InterviewSolutions