1Conceptual Review¶
What is a bit? How many bits are in a byte? Nibble?
Solution
A bit is the smallest unit of digital information and it can be either 0 of 1. There are 4 bits in a nibble and 8 bits in a byte.
What is overflow?
Solution
When the result of an arithmetic operation is outside the range of what is representable by given number of bits.
What is the range of numbers representable by -bit unsigned, sign-magnitude, one’s complement, two’s complement, and biased notation?
Solution
Unsigned:
Sign-Magnitude:
One’s complement:
Two’s complement:
Bias: biasbias
How many ways to represent zero do these representations have, -bit unsigned, sign-magnitude, one’s complement, two’s complement, and biased notation?
Solution
Unsigned: 1
Sign-Magnitude: 2
One’s complement: 2
Two’s complement: 1
Bias: 1 or 0 (depending on bias)
2Short Exercises¶
True/False: Depending on the context, the same sequence of bits may represent different things.
Solution
True. The same bits can be interpreted in many different ways with the exact same bits! The bits can represent anything from an unsigned number to a signed number or even, as we will cover later, a program. It is all dependent on its agreed upon interpretation.
True/False: If you interpret a -bit Two’s complement number as an unsigned number, negative numbers would be smaller than positive numbers.
Solution
False. In Two’s Complement, the MSB is always 1 for a negative number. This means EVERY negative number in Two’s Complement, when converted to unsigned, will be larger than the positive numbers.
True/False: We can represent fractions and decimals in our given number representation formats (unsigned, biased, and Two’s Complement).
Solution
False. Our current representation formats has a major limitation; we can only represent and do arithmetic with integers. To successfully represent fractional values as well as numbers with extremely high magnitude beyond our current boundaries, we need another representation format.
How many numbers can be represented by an unsigned, base-4, -digit number.
A. 1
B.
C.
D.
E.
Solution
C.
How many bits are needed to represent decimal number 116 in binary?
Solution
7 bits. 0b111 0100 or which we round to 7 bits.