6 votes 6 votes 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}\ )$ $\left \lceil \log (n) \right \rceil + 1 \text{ bits}$ $\left \lceil \log (n-1) \right \rceil + 1 \text{ bits}$ $\left \lceil \log (n+1) \right \rceil + 1\text{ bits}$ None of the above Digital Logic isro2018 number-representation digital-logic + – Arjun asked Apr 22, 2018 edited Jan 2, 2020 by `JEET Arjun 6.3k views answer comment Share Follow See all 7 Comments See all 7 7 Comments reply Show 4 previous comments habedo007 commented Oct 27, 2019 reply Follow Share @rajatmyname FInal answer key still says option A is the answer. 1 votes 1 votes mrinmoyh commented Jan 9, 2020 reply Follow Share Can't understand how option A is correct. suppose I have to represent 0 to 17. to represent 17, we can use 5 bits( 4 bits upto 15 & then 1 more bit required). but according to option A, it gives 6 bits to represent 17. 1 votes 1 votes Tuhin Dutta commented Jan 9, 2020 reply Follow Share @MRINMOY_HALDER, No, see its clearly written in question to take the floor and not ceil. so floor(log2 17) + 1 = 4 + 1 = 5. 2 votes 2 votes Please log in or register to add a comment.
9 votes 9 votes Option D is correct. log 0 is $-\infty$ but a variable having value 0 requires 1 bit to store. This eliminates option A and B. For option C take n=3, it will give 3 bits to store value 3. This is false, 3 requires 2 bits only(11 in binary). Thus, option C is also incorrect. Akhilesh Singla answered Apr 22, 2018 Akhilesh Singla comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments Akhilesh Singla commented Apr 23, 2018 reply Follow Share 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. 0 votes 0 votes dark.hacker.beyhadh commented Apr 23, 2018 reply Follow Share We can't put n=0 in option A as domain of logn don't allow that .... So dis formula is valid for n>0... So A) shud be correct for n>0....!!We can't say it is wrong for n=0 as we have not defined it.... 2 votes 2 votes Late Rahul Dikshit commented Apr 24, 2018 reply Follow Share its given from 0 to n , which means n should be greater than 0 . one cant say from 0 to 0 . and 0 and n both are included ,if its saying from 0 to n .. Just you cant take log 0 ,because minimum it will be from 0 to 1 . so option A is only satisfied 0 votes 0 votes Please log in or register to add a comment.
3 votes 3 votes Here we have to choose a variable from the interval (0,n] Note that a number of the form 2^m has m+1 bits. If 2^m<=n<=2^(m+1) then n should also have m+1 bits. Thus any number chosen in between (0,n] should have [log (n)]+1 bits. So,option A is correct. Kushagra Chatterjee answered Apr 22, 2018 edited Apr 26, 2018 by Kushagra Chatterjee Kushagra Chatterjee comment Share Follow See all 8 Comments See all 8 8 Comments reply Show 5 previous comments sonveer tomar 1 commented Apr 22, 2018 reply Follow Share surajumang08, what if we take 0. than log(0) is negative infinity so all 3 option are not following that property 0 votes 0 votes Kushagra Chatterjee commented Apr 22, 2018 i edited by Kushagra Chatterjee Apr 22, 2018 reply Follow Share In the question it is given that the variable n is taking only integral values from 0 to n which means that it is taking integral values in the open interval (0,n) So, it cant take the value 0 or the value n. If n=16 it cant take that value. @suraj 0 votes 0 votes sonveer tomar 1 commented Apr 22, 2018 reply Follow Share in question nothing like open interval is mentioned, 1 votes 1 votes Please log in or register to add a comment.
2 votes 2 votes Let n=8, (i.e variable take value from 0 to 8) (take worst case) in binary: x = log8(base to 2) = 3 But for representing the 8, we need at least (x+1) bit, similarly for n bit, [log n(base to 2) + 1] bit required. Raj Kumar 7 answered Jan 2, 2020 Raj Kumar 7 comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes its given from 0 to n , which means n should be greater than 0 . one cant say from 0 to 0 . and 0 and n both are included ,if its saying from 0 to n . Just you cant take log 0 ,because minimum it will be from 0 to 1 . so option A is only satisfied Late Rahul Dikshit answered Apr 24, 2018 Late Rahul Dikshit comment Share Follow See 1 comment See all 1 1 comment reply Lionel Messi commented Apr 24, 2018 reply Follow Share yeah i thought the same.Hence answer should be A 1 votes 1 votes Please log in or register to add a comment.