What is the output of the following code? [code]all[1, 2, 3, NaN][/code]

What is the output of the following code?
Code:
all[1, 2, 3, NaN]
A. Error due to NaN
B. 1
C. 0
D. Syntactical Error
 
Answer: d
Explanation: Even though the elements were declared within a vector, the syntax of the all() function is wrong since the vector should be present within a pair of parentheses. If the vector was given within a pair of parentheses, the result would’ve been 1. No error will be given due to NaN.
 

Tìm kiếm

Back
Top