rajni wants to create a data-type for the number of books in her book case. her shelf can accommodate a maximum of 75 books. she allocates 7 bits to the data-type. later another shelf is added to her book-case. she realizes that she can still use the same data-type for storing the number of books in her book-case. what is the maximum possible capacity of her new added shelf?
Answers
Answered by
59
Unsigned variables are variables which are internally represented without a mathematical sign (plus or minus) can store 'zero' or positive values only.
Let us say the unsigned variable is n bits in size, then it can represent 2^n (2 power n) values - 0 through (2^n -1).
A signed variable on the other hand, 'loses' one bit for representing the sign, so it can store values from -(2^(n-1) -1) through (2^(n-1)) including zero.
Thus, a signed variable can store positive values, negative values and zero.
unsigned values : 0 through (2^7 - 1)
0 to 127
(Total 128 possible combinations)
signed values : -(2^(7-1) - 1) through (2^(7-1)) including zero
-63 to 64 (i.e. -63 to 0 , 1 to 64)
(Total 128 possible combinations)
sample size for both are same just boundary values are different. Starting number can either be 0 or -63
A bit can be either 0 or 1. For 7bits data-type we can have maximum 2^7=128 combinations(books). first shelf can accommodate max 75 books. Using same data-type she can accommodate 128-75 = 53 more books in new shelf, and it is maximum capacity of the new shelf.
Hope This Helps :)
Let us say the unsigned variable is n bits in size, then it can represent 2^n (2 power n) values - 0 through (2^n -1).
A signed variable on the other hand, 'loses' one bit for representing the sign, so it can store values from -(2^(n-1) -1) through (2^(n-1)) including zero.
Thus, a signed variable can store positive values, negative values and zero.
unsigned values : 0 through (2^7 - 1)
0 to 127
(Total 128 possible combinations)
signed values : -(2^(7-1) - 1) through (2^(7-1)) including zero
-63 to 64 (i.e. -63 to 0 , 1 to 64)
(Total 128 possible combinations)
sample size for both are same just boundary values are different. Starting number can either be 0 or -63
A bit can be either 0 or 1. For 7bits data-type we can have maximum 2^7=128 combinations(books). first shelf can accommodate max 75 books. Using same data-type she can accommodate 128-75 = 53 more books in new shelf, and it is maximum capacity of the new shelf.
Hope This Helps :)
Answered by
2
Answer:
The maximum possible capacity of new added shelf is 53 books
Step-by-step explanation:
Given that :
- Rajni uses 7 bit digit to allocate each book.
- Rajni has maximum 75 books in one shelf.
To find :
- Maximum number of books that can be allocate in second shelf using this 7 bit combination
Solution :
- 1 bit digit can store only two values i.e. 0 and 1.
- Number of possible combinations for 1 bit digit is 2 = 2¹
- 2 bit digit can store four values i.e. 00, 01, 10, 11
- Number of possible combinations for 2 bit digit is 4 = 2².
- Similarly, number of possible combinations for 7 bit digit is 2⁷ = 128.
- Maximum number of books that can be allocate in second shelf = 128 - 75 = 53.
- Hence, total 53 books can be allocate to second shelf using 7 bit digit.
Similar questions