Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose you want to isolate the middle four bits of a byte by placing Os in the

ID: 3667890 • Letter: S

Question

Suppose you want to isolate the middle four bits of a byte by placing Os in the other four bits without disturbing the middle four bits. What mask must you use together with what operation? Suppose you want to complement the four middle bits of a byte while leaving the other four bits undisturbed. What mask must you use together with what operation? Suppose you XOR the first two bits of a string of bits and then continue down the string by successively XORing each result with the next bit in the string. How is your result related to the number of Is appearing in the string? How does this problem relate to determining what the appropriate parity bit should be when encoding a message? It is often convenient to use a logical operation in place of a numeric one For example, the logical operation AND combines two bits in the same mammer as multiplication. Which logical operation is almost the same as adding two bits, and what goes wrong in this case? What logical operation together with what mask can you use to change ASCII codes of lower letters to uppercase? What about uppercase to lowercase? What is the result of performing a three-bit right circular shift on the following bit strings:

Explanation / Answer

1.

Truth table of AND

a.
01001011
10101011
--------
00001011
--------

b.
100000011
11101100

Add 0 at the beginning of second operand

100000011
011101100
---------
000000000
---------

c.
11111111
00101101
--------
00101101
--------

Truth table of OR

d.
01001011
10101011
--------
11101011
--------

e.
10000011
11101100
--------
11101111
--------

f.
11111111
00101101
--------
11111111
--------

Truth table of XOR

g.
01001011
10101011
--------
11100000
--------

h.
10000011
11101100
--------
01101111
--------

i.
11111111
00101101
--------
11010010
--------

----------------------------------------------------------------------------------------------------------------------------

3.

Let the byte be A

the operations on A to get middle four bits complimented is

mask M = 00111100

(~(A & M) & M) | (A&~M)

Consider an example

A = 01101010
M = 00111100

(~(A & M) & M) | (A&~M)

(~(00101000) & 00111100) | (01101010 & 11000011)

(11010111 & 00111100) | (01101010 & 11000011)

(00010100 | 01000010)

01010110

------------------------------------------------------------------------------------------------------------------------

7.
a.
01101010
first right circulat shift
00110101
second right circular shift
10011010
third right circular shift
01001101

b.
00001111
first right circulat shift
10000111
second right circular shift
11000011
third right circular shift
11100001

c.
01111111
first right circulat shift
10111111
second right circular shift
11011111
third right circular shift
11101111

-----------------------------------------------------------------------------------------------------

A B A and B 0 0 0 0 1 0 1 0 0 1 1 1
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote