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

Write the following 4-byte integer values in binary or hexadecimal a. 3 b. 14 c.

ID: 3855395 • Letter: W

Question

Write the following 4-byte integer values in binary or hexadecimal a. 3 b. 14 c. -1 d. The largest unsigned integer. e. The most negative signed integer. Please write a C function int counterOflsBits(unsigned int u) that returns the number of bits in u that are 1. Examples: counterOf 1 sBits [0x00000000] = 0 counterOflsBits[0x00000001] = 1 counterOflsBits[0x00000002] = 1 counterOflsBits[0x00000004] = 1 counterOflsBits[0x00000008] = 1 counterOflsBits[0x00000010] = 1 counterOflsBits[0x00000020] = 1 counterOflsBits[0x00000040] = 1 counterOflsBits[0x00000003] = 2

Explanation / Answer

1)Writing them in binary

a) 11 ( 1*2 + 1*1)

b) 14 ( 1*8+1*4+1*2+0*1)

c) -1

d) 4294967295 (0xffffffff)

e) –2147483648

2)

int counterOf1sBits(unsigned int u)

}