Home / Programming MCQs / Ruby MCQs / Question

V

Vinay Kumar • 8.45K Points
Tutor III

Q. What will be the output of the given code?

Code:
num=4>>2
puts num
(A) -2
(B) 0
(C) 2
(D) 1

Explanation:

left operands value is moved right by the number of bits specified by the right operand.So the answer is 1.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.