N Ngoc Hue New member Sep 19, 2021 #1 What is the output of the following code? Code: function [die,absdif] = BDO(y,x) die = y-x; if nargout > 1 disp('Boo !') absdif = abs(die); end end [p,q]=BDO(Inf,Inf) A. Boo! p=NaN q=NaN B. Boo! p=0 q=0 C. Error D. p=NaN
What is the output of the following code? Code: function [die,absdif] = BDO(y,x) die = y-x; if nargout > 1 disp('Boo !') absdif = abs(die); end end [p,q]=BDO(Inf,Inf) A. Boo! p=NaN q=NaN B. Boo! p=0 q=0 C. Error D. p=NaN
T Thu Ha New member Sep 19, 2021 #2 Answer: a Explanation: Since the number of outputs sought are greater than 1, the if condition gets satisfied and ‘Boo !’ is printed. Inf-Inf will be NaN and hence both p and q will be equal to NaN. Upvote 0 Downvote
Answer: a Explanation: Since the number of outputs sought are greater than 1, the if condition gets satisfied and ‘Boo !’ is printed. Inf-Inf will be NaN and hence both p and q will be equal to NaN.