What is the output of the following command? [code]function ca= ola(p,q) narginchk(0,1) disp(‘Stick!’) o=p-q; end ola(1,2)[/code]

What is the output of the following command?
Code:
function ca= ola(p,q)
narginchk(0,1)
disp(‘Stick!’)
o=p-q;
end
ola(1,2)
A. o=-1
B. o=1
C. Error in inputs
D. Syntactical error while calling function
 
Answer: c
Explanation: The narginchk command has limited the number of inputs to the ola function to 1. But the ola function has been called and 2 inputs are given to it. This gives an error while getting an output from the function.
 

Tìm kiếm

Back
Top