raptor programming
Prelude to Programming, 6th Edition by Stewart Venit and Elizabeth Drake
Try It Yourself: Appendix B: Integer Representation
|
Your name: Type your name here |
|
|
Question |
Answer |
|
1. |
Which type of integer representation would have a range of 0 - 255?
|
|
2. |
Which types of binary integer representation could have a range of: -32,767 … -0 +0 … +32,767 |
|
3. |
Give one example of how unsigned integers might be used by a computer program.
|
|
4. |
(a) In binary representation, 1 + 0 = __________. (b) In binary representation., 1 + 1 = __________. |
|
5. |
In 16-bit unsigned representation, the maximum unsigned integer is __________. |
|
6. |
Which of the following is not an integer: (a) 5 (b) 0 (c) 6.0 (d) 95,842,213 __________ |
|
7. |
Which of the following is not an integer: (a) -5 (b) 4.6 (c) +0 (d) -2,398,421,890 __________ |
|
( continued ( |
|
8. |
Convert the following decimal integers to 8-bit unsigned binary integers or indicate if an overflow condition occurs: (a) 10 __________ (b) 43 __________ |
|
9. |
Convert the following decimal integers to 8-bit unsigned binary integers or indicate if an overflow condition occurs: (a) 129 __________ (b) 304 ___________ |
|
10. |
What is the smallest unsigned integer that can be represented in the following memory allocations: (a) 16-bit ________ (b) 4-bit ________ (c) 128-bit ___________ |
|
11. |
What is the largest unsigned integer that can be represented in the following memory allocations: (a) 4-bit ________ (b) 8-bit _______ (c) 10-bit ___________ |
|
12. |
Convert the following decimal integers to 8-bit sign-and-magnitude integers: (a) +34 ________________ (b) -39 ___________________ |
|
13. |
Convert the following decimal integers to 8-bit sign-and-magnitude integers: (a) -112 _________________ (b) +342 ____________________ |
|
14. |
Represent the following decimal integers in an 8-bit binary location using one’s complement format: (a) +87 ____________________ (b) -15 ____________________ |
|
15. |
Represent the following decimal integers in an 8-bit binary location using one’s complement format: (a) -142 ____________________ (b) -0 ___________________ |
|
( continued ( |
|
|
16. |
Find the two’s complement of the following integers using a 4-bit memory location: (a) +7 ______________________ (b) -7 ____________________ |
|
17. |
Find the two’s complement of the following integers using a 4-bit memory location: (a) -1 _______________________ (b) +13 ____________________ |
|
18. |
Find the two’s complement of the following integers using an 8-bit memory location: (a) +52 _____________________ (b) -59 ______________________ |
|
19. |
Find the two’s complement of the following integers using an 8-bit memory location: (a) -130 ____________________ (b) -118 _____________________ |
|
20. |
What is the largest sign-and-magnitude integer that can be represented in the following memory allocations: (a) 4-bit ___________________ (b) 18-bit ___________________ |
|
Challenge |
Show how the two’s complement works for the binary integer -1659, stored oin a 16-bit memory location. Use the mathematical representation: (2X – N) where X = the number of bits and N= the number
|
PAGE
1
© 2011 Pearson Education