यदि x=1 है तो निम्नलिखित पायथन कोड स्निपेट का आउटपुट क्या होगा?
What will be the output of the following Python code snippet if x=1?
x<<2
A)
B)
C)
D)
Explanation:
The <<
operator shifts the bits to the left. For x = 1
, the binary representation of 1
is 0001
. Shifting it left by 2 positions gives 0100
, which equals 4
.
Answer: (D) 4