❔ If a variable can take integral values from 0 to N, where N is an integer, then the variable can be represented as a bit-field whose width is (the log in the answers are to the base 2, and [logN] means the floor of logN)
(a) [log N] +1 bits
(b) [log(N-1)]+1 bits
(c) [log(N+1)]+1 bits
(d) None of the above
Correct Answer is (a) [log N] +1 bits
Consider the number 128
then, we requires the log[128] +1 == 8 bits required.
for, n=128, the option (b) doesn't satisfy ==> log (floor(128-1)) +1 = between(6 to 7)+1=6+1= 7
now take 127 then option (c) doesn't not satisfy==> log[127+1] +1 == 8 (NOT COORECT, to represent the 127 we need 7 bits only)
(a) [log N] +1 bits
(b) [log(N-1)]+1 bits
(c) [log(N+1)]+1 bits
(d) None of the above
Correct Answer is (a) [log N] +1 bits
Consider the number 128
then, we requires the log[128] +1 == 8 bits required.
for, n=128, the option (b) doesn't satisfy ==> log (floor(128-1)) +1 = between(6 to 7)+1=6+1= 7
now take 127 then option (c) doesn't not satisfy==> log[127+1] +1 == 8 (NOT COORECT, to represent the 127 we need 7 bits only)
No comments:
Post a Comment