Computer Science CH 1 (Example Q&A)
Computer Science CH 1 (Example Q&A)
1. What input bit patterns will cause the following circuit to produce an output of 1?
2. In the text, we claimed that placing a 1 on the lower input of the flip-flop in Figure 1.3 (while
holding the upper input at 0) will force the flip-flop’s output to be 0. Describe the sequence of
events that occurs within the flip-flop in this case.
3. Assuming that both inputs to the flip-flop in Figure 1.5 are 0, describe the sequence of events
that occurs when the upper input is temporarily set to 1.
4. (a) If the output of an AND gate is passed through a NOT gate, the combination computes
the Boolean operation called NAND, which has an output of 0 only when both its inputs are 1.
The symbol for a NAND gate is the same as an AND gate except that it has a circle at its output.
The following is a circuit containing a NAND gate. What Boolean operation does the circuit
compute?
(b) If the output of an OR gate is passed through a NOT gate, the combination computes the
Boolean operation called NOR that has an output of 1 only when both its inputs are 0. The
symbol for a NOR gate is the same as an OR gate except that it has a circle at its output. The
following is a circuit containing an AND gate and two NOR gates. What Boolean operation
does the circuit compute?
2|Page
ANSWERS
1. In the first case, memory cell number 6 ends up containing the value 5. In the second case,
it ends up with the value 8.
2. Step 1 erases the original value in cell number 3 when the new value is written there.
Consequently, Step 2 does not place the original value from cell number 3 in cell number 2.
The result is that both cells end up with the value that was originally in cell number 2.
A correct procedure is the following:
Step 1. Move the contents of cell number 2 to cell number 1.
Step 2. Move the contents of cell number 3 to cell number 2.
Step 3. Move the contents of cell number 1 to cell number 3.
3. 32768 bits
ANSWERS
1. Faster retrieval of data and higher transfer rates
2. The point to remember here is that the slowness of mechanical motion compared with the
speed of the internal functioning of the computer dictates that we minimize the number of times
we must move the read/write heads. If we fill a complete surface before starting the next, we
must move the read/write head each time we finish with a track. The number of moves therefore
is approximately the same as the total number of tracks on the two surfaces. If, however, we
alternate between surfaces by electronically switching between the read/write heads, we must
move the read/write heads only after each cylinder has been filled.
3|Page
3. In this application, information must be retrieved from mass storage in a random manner,
which would be time consuming in the context of the spiral system used on CDs and DVDs.
(Moreover, current technology does not allow individual portions of data to be updated on a
CD or DVD.)
4. Storage space is allocated in units of physical sectors (actually in units of groups of sectors
in most cases). If the last physical sector is not full, additional text can be added without
increasing the storage space allocated to the file. If the last physical sector is full, any addition
to the document will require additional physical sectors to be allocated.
5. Flash drives do not require physical motion so they have shorter response times and do not
suffer from physical wear.
6. A buffer is a data storage area used to hold data on a temporary basis, usually as a means of
absorbing inconsistencies between the data’s source and ultimate destination.
4|Page
0000110000000101 (the byte 00001100 is represented by 12, and 00000101 is represented by
5), and the pattern 100010000001000000000111 is represented by 136.16.7. Represent each of
the following bit patterns in dotted decimal notation.
a. 0000111100001111 b. 001100110000000010000000
c. 0000101010100000
9. What is an advantage of representing images via geometric structures as opposed to bit
maps? What about bit map techniques as opposed to geometric structures?
10. Suppose a stereo recording of one hour of music is encoded using a sample rate of 44,100
samples per second as discussed in the text. How does the size of the encoded version compare
to the storage capacity of a CD?
ANSWERS
1. Computer Science
2. The two patterns are the same, except that the sixth bit from the low-order end is always 0
for uppercase and 1 for lowercase.
3. a. 00100010 01010011 01110100 01101111
01110000 00100001 00100010 00100000
01000011 01101000 01100101 01110010
01111001 01101100 00100000 01110011
01101000 01101111 01110101 01110100
01100101 01110100 00101110
b. 01000100 01101111 01100101 01110011
00100000 00110010 00100000 00101011
00100000 00110011 00100000 00111101
00100000 00110101 00111111
4. a. 5 b. 9 c. 11 d. 6 e. 16 f. 18
6. a. 110 b. 1101 c. 1011 d. 10010 e. 11011 f. 100
7. In 24 bits, we can store three symbols using ASCII. Thus, we can store values as large as
999. However, if we use the bits as binary digits, we can store values up to 16,777,215.
8. a. 15.15 b. 51.0.128 c. 10.160
9. Geometric representations are more conducive to changes in scale than images encoded as
bit maps. However, geometric representations do not typically provide the same photographic
quality that bit maps produce. Indeed, as discussed in Section 1.8, JPEG representations of bit
maps are very popular in photography.
5|Page
10. With a sample rate of 44,100 samples per second, one hour of stereo music would require
635,040,000 bytes of storage. Thus, it would just about fill a CD whose capacity is slightly
more than 600MB.
1.5 The Binary System
1. Convert each of the following binary representations to its equivalent base ten form:
a. 101010 b. 100001 c. 10111 d. 0110 e. 11111
2. Convert each of the following base ten representations to its equivalent binary form:
a. 32 b. 64 c. 96 d. 15 e. 27
3. Convert each of the following binary representations to its equivalent base ten form:
a. 11.01 b. 101.111 c. 10.1 d. 110.011 e. 0.101
4. Express the following values in binary notation:
a. 41⁄2 b. 23⁄4 c. 11⁄8 d. 5⁄16 e. 55⁄8
5. Perform the following additions in binary notation:
a. 11011 b. 1010.001 c. 11111 d. 111.11
+1100 +1.101 +0001 + 00.01
ANSWERS
1. a. 42 b. 33 c. 23 d. 6 e. 31
2. a. 100000 b. 1000000 c. 1100000 d. 1111 e. 11011
3. a. 31⁄4 b. 57⁄8 c. 21⁄2 d. 63⁄8 e. 5⁄8
4. a. 100.1 b. 10.11 c. 1.001 d. 0.0101 e. 101.101
5. a. 100111 b. 1011.110 c. 100000 d. 1000.00
7|Page
Case 2. If the sign bits are both 0, scan the remaining portions of the patterns from left to right
until a bit position is found where the two patterns differ. The pattern containing the 1 in this
position represents the larger value.
Case 3. If the sign bits are both 1, scan the remaining portions of the patterns from left to right
until a bit position is found where the two patterns differ. The pattern containing the 0 in this
position represents the larger value.
The simplicity of this comparison process is one of the reasons for representing the exponent
in floating-point systems with an excess notation rather than with two’s complement.
4. The largest value would be 71⁄2, which is represented by the pattern 01111111. As for the
smallest positive value, you could argue that there are two “correct” answers. First, if you
stick to the coding process described in the text, which requires the most significant bit of the
mantissa to be 1 (called normalized form), the answer is 1⁄32, which is represented by the
pattern 00001000. However, most machines do not impose this restriction for values close to
0. For such a machine, the correct answer is 1⁄256 represented by 00000001.
8|Page