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

Tiên Hương

New member
What will be the output of the following code?
Code:
all([or(1,1), ~xor(xor(1,0),1), cos(pi)])
A. 0
B. 1
C. Error
D. No such function all
 
Answer: b
Explanation: The all() function returns 1 iff all the elements within the input vector is non-zero. Here, xor(1,0) is 1 and ~xor(1,1) is 1. or(1,1) is 1 and cos(pi) is -1. Thus, all the elements are non-zero.
Output: 1
 

Tìm kiếm

Back
Top