please show steps, thanks. You are only given operations of the following four p
ID: 3588946 • Letter: P
Question
please show steps, thanks.
You are only given operations of the following four patterns: 1. SHIFTBY.BITS TO THE LEFT PRODUCING 2. SHIFTBY...BITS TO THE RIGHT PRODUCING. 3. BITWISE-AND... WITH... PRODUCING. 4. BITWISE-OR... WITH..PRODUCING.. For example, to solve a particular.problem you might say: SHIFT 10100111 BY 4 BITS TO THE LEFT PRODUCING X SHIFT 00110101 BY 2 BITS TO THE RIGHT PRODUCING Y BITWISE-AND X WITH YPRODUCING Z BITWISE-OR Z WITH 01010101 PRODUCING THE ANSWER Provide a sequence of operations that will extract the highest 4 bits from the bit-string 11011001, that is, the result of the operations will be 00001101. The result should be stored in 8-bits. (3 points) Provide a sequence of operations that will take the lowest 3 bits of the bit-string 11001110 and the lowest 3 bits of the bit-string 00111111 and concatenate them together, to produce 00110111. The result should be stored in 8-bits. (3 points)Explanation / Answer
Solution====================
Question 1)
X=11011001
Rightshift 4 bits producing:
X=00001101 (if logical shift otherwise)
X=11111101 (if arithmetic shift)
If its a logical shift, you already have an answer,
if arithmetic shift, then
Bitwise X with 00001101, will produce the result:
00001101
Question 2)
x=11001110
y=00111111
Bitwise AND of X with 00000110
X=00000110
left shift 3 bits:
X=00110000
Bitwise And of Y with 00000111 :
Y=00000111
Bitwise OR 0f X and Y is answer:
00110000
00000111
------------
00110111
Let me know if any doubts...
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.