a let x be an 8 bit variable of type char the following exercises test your knowledg 5346191

a.) Let x be an 8-bit variable (of type char). The following exercises test your knowledge of bit masking. For the following, write a single line of C code that represents the given description. The first has been completed for you. (5 pts)

i) Description: if bit 0 of x is set

if (x & 0x01)

ii) Description: while bit 5 and 4 of x is clear

iii) Description: clear the upper 4 bits of x while preserving the lower 4 bits

iv) Description: toggles bits 7, 6, 3, and 2 of x while persevering the rest

v) Description: clear bit 3 and set bit 7 while preserving the other bits

b) Using bitwise operators, shift operators, and a single for loop, complete the following C function to pack the one-value bits in a variable x, of type unsigned short, into bit positions 0 to

"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now