Homework 3

advertisement
Computer Science 101
Homework Set 3
Due Monday, November 1
Name:
Pledged:
All homework should be turned in at class time and done in a neat fashion. Start on them
early so that you will have time to see me for help if needed. You may work together
with one other person from the class (only one). If the work is exactly the same for two
people, turn in one paper with both names. Show your work!
1. Convert the given decimal numbers to 10-bit 2’s complement numbers:
a. 406
406 = 256+128+16+4+2;
so 0110010110
b. -406 from part a), flip bits and add 1: 1001101001 + 1 = 1001101010
2. Give the decimal values for the following 8-bit unsigned binary numbers:
a.
11010010
128 + 64 + 16 + 2 = 210
b.
01011001
64 + 16 + 8 + 1 = 89
3. Give the decimal values for the following 8-bit 2’s complement numbers:
a.
11010010
For –X: 00101101 + 1 = 00101110: 32 + 8 + 4 + 2 = 46
So X = -46
b.
01011001
64 +16 + 8 + 1 = 89
4. Our computers use the 32-bit 2’s complement for signed integers. For the
following decimal numbers, first give the 32-bit 2’s complement value. Then
write the result in hexadecimal.
a.
78 = 64 + 8 + 4 + 2
2’s complement: 00000000000000000000000001001110
Hex: 4E
b. -78
2’s complement: 11111111111111111111111110110001 + 1
= 1111 1111 1111 1111 1111 1111 1011 0010
Hex: FFFFFFB2
Note: You could check your answers and verify that this is the system being used
by using the hex function in JES.
5. Give the following and explain (Log denotes logarithms to base 10 and Lg
denotes logarithms to base 2):
a. Log(1,000,000,000) = 9 (The number is 10 to the 9th.
b. Lg(4096) = 12 (2 to 12th is 4096)
6. Choose the correct answer and explain:
Suppose Sound1 is measured at 40 dB and Sound2 is measured at 80 dB. Then
a. Sound2 is 3 times as loud as Sound1.
b. Sound2 is twice as loud as Sound1.
c. Sound2 is 100 times as loud as Sound1
d. Sound2 is 1,000 times as loud as Sound1
e. Sound2 is 10,000 times as loud as Sound1
Each increase of 10db multiplies “loudness” by 10.
f. Sound2 is 1,000,000 times as loud as Sound1
Download