When a binary shift operation is performed binary data can be shifted right or l
ID: 3885470 • Letter: W
Question
When a binary shift operation is performed binary data can be shifted right or left and a '0' is brought to fill vacated positions while the bit that is shifted out is discarded. Shift the 8-bit binary number that is equivalent to 0x18 right two, give the result in binary. When a binary rotate operation is performed binary data can be shifted right or left: the bit that is shifted out from one end will be brought back in on the other end. Rotate the 8-bit binary number that is equivalent to 0x5B left two, give the result in binary. For an 8-bit (byte) sized binary number, what mask and operation would you use to clear the lower nibble without changing the upper nibble? a. Mask (in binary) b. OperationExplanation / Answer
15)
0x18 is in hexadecimal. In decimal, it will be 24. Its binary value will be 0001-1000
1
1
0
0
0
Shifting it to right 2 times…will give us:
1
1
0
0
0
->
0
0
1
1
0
So, 0000-0110
Which is 0x06. (Note: shifting left would have given us the value 0x60).
16)
(0x5B) 16 = (91) 10 = (0101-1011) 2
Rotating it for left 2 times will give us
0
1
0
1
1
0
1
1
->
0
1
1
0
1
1
0
1
So, 0110-1101
Which is 0x6D.
17)
a) Mask: (11110000) 2
b) Operation: bitwise-AND
1
1
0
0
0
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.