आइए मान लें कि 4 बाइनरी में 100 है और 11 1011 है। निम्नलिखित बिटवाइज़ का आउटपुट संचालक क्या है?
Let us assume 4 is 100 in binary and 11 is 1011. What is the output of the following bitwise operators ?
a = 4
b = 11
print(a | b)
print(a >> 2)
A)
B)
C)
D)
Explanation:
Let's go through it briefly:
-
Bitwise OR (
|
):a = 4
(binary:100
),b = 11
(binary:1011
)- OR operation gives
1111
in binary, which equals 15 in decimal.
-
Right Shift (
>>
):a = 4
(binary:100
)- Shifting right by 2 positions:
100
becomes1
, which equals 1 in decimal.
Final Output:
(A) 15 1