Predict the output of the following pseudo-code
Integer p, q, r, s Set p = 1, q = 2, r = 0 s = (p XOR q) OR (r | 1) Print s
(A)
1
(B)
2
(C)
3
(D)
5
Answer: (C)
Explanation:
Initial value of p = 1, q = 2, r = 0
Now s = (p XOR q) OR (r OR 1)
s = 3 | 1
s = 3
Quiz of this Question
Please comment below if you find anything wrong in the above post
Article Tags :
Uncategorized
Recommended Articles