What will be the output of the following code? [code]A=sim(pi)+cod(pi)[/code]

Trần Vũ

New member
What will be the output of the following code?
Code:
A=sim(pi)+cod(pi)
A. A=-1
B. Undefined function or variable ‘cod’
C. Undefined function or variable ‘sim’
D. Undefined function or variable ‘sim’ and ‘cod’
 
Answer: c
Explanation: ‘sin’ and ‘cod’ functions have been written in place of ‘sine’ and ‘cos’ functions. If there are more than 1 error in a line of code, MATLAB will return only the first error it comes across. It will neglect the rest of the code. So it ignores the error ‘cod’.
 

Tìm kiếm

Back
Top