Practice Problems
Try each problem before looking at the answers.
-
Show how you can count to 35 on your hands.
Show Answer
Review Counting on Your Fingers for the description and video presentation. -
What digits are used for counting in decimal?
Show Answer
0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. -
What digits are used for counting in hexadecimal?
Show Answer
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. It doesn’t matter whether you use uppercase or lowercase letters. -
What digits are used for counting in octal?
Show Answer
0, 1, 2, 3, 4, 5, 6, and 7. -
What digits are used for counting in binary?
Show Answer
0 and 1. -
Regardless of the number base, what quantity does the rightmost digit in an integer count?
Show Answer
Ones. In all bases, the rightmost digit in an integer counts by 1. In base 10, for example, the ones place counts 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. When we arrive at 10, the ones place rolls back to zero, and we write a 1 in the tens place.
In binary, the ones place counts 0 or 1. When we pass 1, the ones place flips back to 0, and we write a 1 in the twos place. The same thing happens in octal, only when we pass 7 in the ones place, we go back to zero in the ones place and write a 1 in the eights place. In hexadecimal, we count 0 through F in the ones place, then we go back to zero in the ones place and write a 1 in the sixteens place. -
What is the nine’s complement of 27?
Show Answer
72
To get the nine’s complement, subtract each digit of the number from 9. 9 - 2 = 7 and 9 - 7 = 2, so the result is 72. -
What is the nine’s complement of 50?
Show Answer
49
9 - 5 = 4 and 9 - 0 = 9 -
What is the nine’s complement of 999?
Show Answer
000
9 - 9 = 0 for all 3 digits. Note that we need to write the same number of digits as the original. -
Use nine’s complement arithmetic to compute 80 - 60. Show your work.
Show Answer
The answer is 20, which you might have recognized immediately. However, the answer isn’t the point here: the process is. Thus, let’s look at how we perform the subtraction:
First, take the nine’s complement of the subtrahend, which is the number to the right of the minus sign (or the bottom number when written vertically). In this case, the subtrahend is 60. Computing the nine’s complement of 60 means subtracting each digit independently from 9. Thus, 9 - 6 = 3 and 9 - 0 = 9, giving us a complement value of 39.
Now add the minuend (80) to the nine’s complement of the subtrahend (39). The result is the digit sequence 119. This is not one hundred nineteen! Instead, it is a carry-out of 1 followed by the digit sequence 19. Since the carry-out is 1, perform an end-around-carry and add the 1 to the digit sequence (now taken as a number) 19. 19 + 1 = 20, which is the final result. -
Use nine’s complement arithmetic to compute 77 - 42. Show your work.
Show Answer
Begin by taking the nine’s complement of 42, which is 57. Add 77 + 57 = 134. Since 134 has more digits than the minuend or subtrahend, the meaning of 134 is a carry-out of 1 with a result of 34. Perform the end-around carry and add 34 + 1 = 35. -
Use nine’s complement arithmetic to compute 132 - 97. Show your work.
Show Answer
The minuend (132) has 3 digits, while the subtrahend (97) has two digits. We need these numbers to have the same number of digits to make our arithmetic work properly, so put a leading zero on the subtrahend. Thus, we start by rewriting the problem as 132 - 097.
Taking the nine’s complement of the subtrahend, we get 902. Add 132 + 902 = 1034. 1034 has more digits than the minuend or subtrahend, so we have a carry-out of 1 and a result of 034. Perform the end-around carry and add 034 + 1 = 035. We can now drop the leading zero to get our final answer of 35. -
Use nine’s complement arithmetic to compute 97 - 132. Show your work.
Show Answer
In this case, the minuend has 2 digits, while the subtrahend has 3 digits. Therefore, we put a leading zero on the minuend to make both numbers have the same number of digits. Write the problem as 097 - 132.
Computing the nine’s complement of 132 yields 867. Adding 097 + 867 = 964. The result of this addition has the same number of digits as the minuend or subtrahend, which means we have a carry-out of zero.
A carry-out of zero means our result is negative. So we begin by writing a minus sign. Next, we take the nine’s complement of 964, which is 035. With the minus sign in front, the result is -035 or -35. -
What is the result of shifting the 8-bit binary number 0000 0100 to the left by one?
Show Answer
0000 1000
The leftmost zero rolls off the left side of the number, while a new zero is rolled onto the right side. All the other digits move left by one place. -
What is the result of shifting the signed 8-bit binary number 1111 0000 to the right by one, using a logical right shift?
Show Answer
0111 1000
A logical right shift always shifts to the right by dropping the rightmost digit(s) in the number and inserting zeroes on the left side. In this case, the rightmost zero fell off as a result of the shift, and a new zero was pushed in from the left side. -
What is the result of shifting the signed 8-bit binary number 1111 0000 to the right by one, using an arithmetic right shift?
Show Answer
1111 1000
An arithmetic right shift duplicates the sign bit when performing the shift. Remember that the sign bit is the leftmost bit. Therefore, this shift drops the rightmost zero from the right end of the number and duplicates the sign bit, adding a 1 to the left side of the result. -
What is the result of shifting the signed 8-bit binary number 0100 0001 to the right by one, using an arithmetic right shift?
Show Answer
0010 0000
An arithmetic right shift duplicates the sign bit, which is zero in this case. Therefore, a zero is shifted onto the left side of the number, while the rightmost bit falls off the right side. In this case, the rightmost bit that fell off happened to be a 1. -
What standard do we typically use for floating-point numbers inside computers?
Show Answer
IEEE 754
This is one of those things you just need to know. -
Which of the following kinds of numbers stores the greatest number of significant digits: single precision, double precision, or quad precision?
Show Answer
Quad precision. -
In a floating-point number, how many representations are there for the number 0? Why?
Show Answer
2 (two)
IEEE 754 floating-point uses signed magnitude, so there is both a +0 and a -0. -
What are the 3 parts of a number when using the IEEE 754 standard?
Show Answer
Sign bit, biased exponent, and trailing significand. -
What is the purpose of a subnormal floating-point number?
Show Answer
Subnormal numbers delay the point at which the number gets rounded to zero. -
What is the difference between hard float and soft float?
Show Answer
Hard float uses a dedicated circuit (floating-point unit) to perform floating-point calculations. Soft float performs floating-point calculations entirely in software, without requiring special hardware. Hard float is faster than soft float.