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