문제

Sorry this is a really silly question, was just looking through an old exam paper for my Operating Systems class and noticed this question can come up every so often. How does one work out the answer to this ? I don't really understand.

Another question is :

What are the maximum and minimum unsigned integers that can be represented by 7 bits, 9 bits and 10 bits?

Would anyone be able to tell me how you would work this out ? Is it just 2^7 ?

Thanks a lot ! :)

도움이 되었습니까?

해결책

How many bits are necessary to address 32 bytes ?

5 (since 2^5==32). In other words log2(32). If the number in question (32) wasn't a power of two, you would need to round the answer up.

What are the maximum and minimum unsigned integers that can be represented by 7 bits, 9 bits and 10 bits?

The minimum unsigned int is always zero, regardless of the number of bits. The maximum unsigned ints are 2^7-1 (127), 2^9-1 (511) and 2^10-1 (1023) respectively.

This link provides a decent enough explanation.

다른 팁

How many digits are required to express the numbers 0 through 99 inclusive? 2, right?

How did you do that? By looking at the numbers? Well - there are 100 numbers, so you can take the logarithm base 10 of 100 (equivalently, you can mentally fill in the blank: 10 to the power of _ = 100). Or you can realise that there are 100 numbers because the range 0..99 is the same size as the range 1..100.

It all works the same way with bits, except you are now in base 2 instead of base 10. (In before someone makes the smart-aleck comment that "every base is base 10".)

Someone correct me if I am wrong but max unsigend ints is (2^x - 1)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top