MathWorks Interview Question

MATLAB coding, involves syntax and index problem