What is the output of the following code? [code]mean({1 2 3})[/code]

Thanh Thảo

New member
What is the output of the following code?
Code:
mean({1 2 3})
A. 2
B. Logical Error
C. 1
D. Syntactical Error
 
Answer: d
Explanation: Since the mean command uses the sum command, it also cannot accept cellular arrays as input since this input will go to the sum command first. Hence, the above code will give a syntactical error. Now, if we had given the input, within parentheses, within []- the output would’ve been 2 only.
 

Tìm kiếm

Back
Top