1.

Choose the correct option.(a) any() shows all the elements in a matrix while all() shows every element of a vector(b) any() is ‘true’ if elements in a vector is zero(c) all() is ‘true’ if every element in a vector is non zero(d) all() is ‘true’ if every element in a vector is 0The question was posed to me during an online exam.The origin of the question is Variables and Assignments in chapter MATLAB Basics of MATLAB

Answer» RIGHT choice is (c) all() is ‘true’ if every element in a VECTOR is non zero

Easy explanation: ‘any()’ and ‘all()’ are pre-defined FUNCTIONS in MATLAB. The function ‘any()’ returns 1 if every element of the vector, mentioned WITHIN the PARENTHESES, is non-zero. The function ‘all()’ returns 1 if any element of the vector is non-zero.


Discussion

No Comment Found

Related InterviewSolutions