Can not understand. How to solve this problem help friends | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can not understand. How to solve this problem help friends

This task was given to me. Assume the numbers are unsigned 8-bit numbers. Enter your answer as a decimal number (not binary). 7 | (~125 << 3) I answered -9 in decimal notation. But this is wrong.

30th Dec 2020, 7:22 AM
Aid
Aid - avatar
5 Answers
+ 5
Answer may be 23 Since numbers are unsigned 8 bit 125 in binary is 01111101 and ~125 is 10000010 which is 130 130 << 3 is 16 And 7 | 16 is 23
30th Dec 2020, 7:48 AM
Padala Vamsi
Padala Vamsi - avatar
+ 4
Sorry, my answer has little bit of correction. But the answer is same.
30th Dec 2020, 11:42 AM
Padala Vamsi
Padala Vamsi - avatar
+ 4
Martin Taylor, but in the question there is no -125 it is ~125. Sorry if I am wrong.
30th Dec 2020, 12:14 PM
Padala Vamsi
Padala Vamsi - avatar
+ 1
sai vamsi thanks 😊
30th Dec 2020, 8:01 AM
Aid
Aid - avatar
+ 1
Martin Taylor , I think your screen is showing it as negative but it is a bitwise not symbol not negative
30th Dec 2020, 12:24 PM
Padala Vamsi
Padala Vamsi - avatar