If a variable can take only 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 answer are to the base $2$, and $\left \lceil \log_{}{n} \right \rceil$ means the floor of $\log_{}{n}\ )$
@MRINMOY_HALDER, No, see its clearly written in question to take the floor and not ceil.
so floor(log2 17) + 1 = 4 + 1 = 5.
Option B with n=0 will give complex values. With approximation(see image) and floor, it will give us 4+1=5 bits to represent 0, which is wrong.
@kushagra if you take n = 16 then option B will give a result floor( log2(15) ) + 1 which is 4 but you need 5 bits to represent 16. The same srgument can be given for all the numbers of the form 2k . Option A is the correct answer as per me.
64.3k questions
77.9k answers
244k comments
80.0k users