How many bits do we need to represent a variable that can only take on the values 11, 22, 33, or 44? If the only value a variable can take on is 32.16, how many bits are needed to represent it?

Counting

Bit strings can be used to represent more than just numbers. In fact, we use bit strings to represent everything inside a computer. And, because we don’t want to be wasteful with bits, it is important to remember that n bits can be used to represent 2n distinct numbers. For each of the following questions, answer with the minimum number of bits possible:

3.1 Exercises

(5 pts) How many bits do we need to represent a variable that can only take on the values 11, 22, 33, or 44?

(5 pts) If the only value a variable can take on is 32.16, how many bits are needed to represent it?

(5 pts) If we need to address 4 Mi-Byte of memory and we want to address every byte of memory, how long does an address need to be?

How many bits do we need to represent a variable that can only take on the values 11, 22, 33, or 44? If the only value a variable can take on is 32.16, how many bits are needed to represent it?
Scroll to top