What will be the output of the following code? [code]any(xor(1,1), ~or(xor(1,0),1), sin(pi), NaN)[/code]

What will be the output of the following code?
Code:
any(xor(1,1), ~or(xor(1,0),1), sin(pi), NaN)
A. 0
B. 1
C. Error due to too many arguments
D. Error due to NaN
 
Answer: c
Explanation: The all() function takes a single vector as input. If we had placed all the elements within [], there wouldn’t have been any error and the output would’ve been 1. NaN won’t give any error infact the occurrence of NaN will give the output 1 or the output would’ve been 0.
 

Tìm kiếm

Back
Top