Open In App

ISRO | ISRO CS 2018 | Question 62

Like Article
Like
Save
Share
Report

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 answers are to the base 2, and [log n] means the floor of log n)
(A) [log(n)] + 1 bits
(B) [log (n-1)) + 1 bits
(C) [log (n+1)] + 1 bits
(D) None of the above


Answer: (A)

Explanation: Suppose a number 64 is to represented as a bit-field then its width would be [log(n)] + 1 (with base 2).
So, ((log264) + 1) = 6 + 1 = 7 bits are required.

Option (A) is correct.

Quiz of this Question


Last Updated : 20 Nov, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads