What is the output of the following command? [code]function pu= hu(p,varargin) narginchk(0,1) disp(‘Stick!’) o=sin(varargin{1}); end ola(1,p/2)[/code]

Khang Lê

New member
What is the output of the following command?
Code:
function pu= hu(p,varargin)
narginchk(0,1)
disp(‘Stick!’)
o=sin(varargin{1});
end
ola(1,p/2)
A. Error due to line 2
B. Error due to line 5
C. Error due to syntax
D.
Stick!
o=1
 
Answer: a
Explanation: The varargin command restricts the input to the function to only 1 argument. Hence, the function stops working and we will get an error due to line 2 of the above code.
 

Tìm kiếm

Back
Top