Python Questions and Answers – Bitwise – 1

Q 1. What will be the output of the following Python code snippet if x=1? x<<2 A. 8B. 1C. 2D. 4 Show Answer Answer:-D. 4 Explanation The binary form of 1 is 0001. The expression x<<2 implies we are performing bitwise left shift on x. This shift yields the value: 0100, which is the binary … Continue reading Python Questions and Answers – Bitwise – 1