What is the output of the following code? [code]lengths([1 2 3])[/code]

What is the output of the following code?
Code:
lengths([1 2 3])
A. 3
B. 1*3
C. Error due to lengths command
D. Cannot be determined
 
Answer: c
Explanation: The length command is used but since we have an extra ‘s’ after it, the command is not recognized by MATLAB. Hence, this leads to an error. Otherwise, the output would’ve been 3 only.
 

Tìm kiếm

Back
Top