And are two 8-bit numbers such that A+B≤2 The number
2018
A and B are two unsigned 8-bit numbers such that A + B <= 28. The number of possible combinations of A and B is:
- A.
29
- B.
28
- C.
33,151
- D.
24 - 1
Attempted by 427 students.
Show answer & explanation
Correct answer: C
Correct answer: 33,151.
For unsigned 8-bit numbers,
AandBcan each range from 0 to 255.The condition is
A + B <= 256. ForA = 0andA = 1,Bcan take all 256 values.For
A = 2to255, the number of possibleBvalues is257 - A. This gives255 + 254 + ... + 2values.Total =
256 + 256 + (255 + 254 + ... + 2) = 512 + 32639 = 33151.