What is the output of the following code? [code]cumsum[NaN][/code]

Trường Phan

New member
What is the output of the following code?
Code:
cumsum[NaN]
A. NaN
B. 0
C. Error due to NaN
D. Syntactical Error
 
Answer: d
Explanation: The cumsum() function accepts inputs within parentheses. Since we have only placed the NaN as a vector element, but not within parentheses, the result will be an error. NaN won’t give an error, the result would’ve been NaN if it wass given within parentheses.
 

Tìm kiếm

Back
Top