Using the unsigned interpretation, 0b10011 represents decimal value ________.
19
Correct!
25
Incorrect.
38
Incorrect.
50
Incorrect.
Exercise4.2.2.Hexadecimal to Binary.
Consider the hexadecimal value 0xff70e65c. How many bits (binary digits) are needed to store this hex value?
8
Incorrect
9
Incorrect.
32 (i.e. 4 * 8)
Correct!
36 (i.e. 4 * 9)
Incorrect.
64 (i.e. 8 * 8)
Incorrect.
72 (i.e. 8 * 9)
Incorrect.
Hint.
Each hexadecimal digit maps to four binary digits: 0x 0 ~ F -> 0b 0000 ~ 1111. 0x is the prefix for a hex number, not part of the value.
Exercise4.2.3.Binary Representation.
How many different values can a 6-bit unsigned binary number represent?
What’s the largest possible value?
Hint.
Being unsigned, the range of values starts from 0 (all bits are 0s). That means the largest value would be \(2^n - 1\text{.}\)
Exercise4.2.4.Values Representable by n-bit Unsigned Binary Numbers.
A C program needs to handle unsigned integer values in the range of 200 ~ 2000. What’s the smallest unsigned type (least number of bits) we may use to store such values?
unsigned short (16 bits)
Correct!
unsigned char (8 bits)
Incorrect.
unsigned int (32 bits)
Incorrect.
unsigned long (64 bits)
Incorrect.
Hint1.
Unsigned values start at 0.
Hint2.
The maximum value for an unsigned binary number of N bits is \(2^N - 1\text{.}\)
Exercise4.2.5.Understanding Size of Numbers Stored in Binary.
Assume that a user’s password is a number, such as a PIN for an ATM, and that it is stored in a binary representation in the computer. If you can perform 10,000 tests per second, how long will it take you to go through all possible passwords if the passwords are stored in:
16 bits: seconds
32 bits: seconds
Round your answer to the nearest whole number.
Exercise4.2.6.Decimal Numbers.
Assume that we have a decimal number where \(d_5\) is 6. How much does this digit contribute to the overall value of the number?
6
Incorrect.
60
Incorrect.
600
Incorrect.
6000
Incorrect.
60000
Incorrect.
600000
Correct!
\(6 * 10^5\) is 600000
6000000
Incorrect.
Exercise4.2.7.Understanding Binary.
How can you tell at a glance if a binary number is even? Why does this trick work?
The leftmost bit of the number is 0
Incorrect.
The rightmost bit of the number is 0
Correct!
A binary number is even if and only if its least-significant digit is a 0.
The number contains an even number of 0s
Incorrect.
The number contains an odd number of 0s
Incorrect.
Exercise4.2.8.Hexadecimal.
For each of the two hex values listed below, what is the hexadecimal value that precedes it?