0% found this document useful (0 votes)
211 views8 pages

Computer Science CH 1 (Example Q&A)

The document discusses binary representations and data storage. It provides examples of encoding text and numbers in binary and ASCII formats. It also discusses different computer memory and storage systems like RAM, hard disks, CDs, and their capacities. Key topics covered include binary, hexadecimal, ASCII encoding, memory size calculations, hard disk storage of updating data vs read-only CDs, and file size increases from text additions.

Uploaded by

Min Khant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
211 views8 pages

Computer Science CH 1 (Example Q&A)

The document discusses binary representations and data storage. It provides examples of encoding text and numbers in binary and ASCII formats. It also discusses different computer memory and storage systems like RAM, hard disks, CDs, and their capacities. Key topics covered include binary, hexadecimal, ASCII encoding, memory size calculations, hard disk storage of updating data vs read-only CDs, and file size increases from text additions.

Uploaded by

Min Khant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CHAPTER 1

1.1 Bits and Their Storages

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?

5. Use hexadecimal notation to represent the following bit patterns:


a. 0110101011110010 b. 111010000101010100010111
c. 01001000
6. What bit patterns are represented by the following hexadecimal patterns?
a. 5FD97 b. 610A c. ABCD d. 0100
1|Page
ANSWERS
1. One and only one of the upper two inputs must be 1, and the lowest input must be 1.
2. The 1 on the lower input is negated to 0 by the NOT gate, causing the output of the AND
gate to become 0. Thus, both inputs to the OR gate are 0 (remember that the upper input to the
flip-flop is held at 0) so the output of the OR gate becomes 0. This means that the output of the
AND gate will remain 0 after the lower input to the flip-flop returns to 0.
3. The output of the upper OR gate will become 1, causing the upper NOT gate to produce an
output of 0. This will cause the lower OR gate to produce a 0, causing the lower NOT gate to
produce a 1. This 1 is seen as the output of the flip-flop as well as being fed back to the upper
OR gate, where it holds the output of that gate at 1, even after the flip-flop’s input has returned
to 0.
4. a. The entire circuit is equivalent to a single OR gate.
b. This entire circuit is also equivalent to a single XOR gate.
5. a. 6AF2 b. E85517 c. 48
6. a. 01011111110110010111
b. 0110000100001010
c. 1010101111001101
d. 0000000100000000

1.2 Main Memory


1. If the memory cell whose address is 5 contains the value 8, what is the difference between
writing the value 5 into cell number 6 and moving the contents of cell number 5 into cell
number 6?
2. Suppose you want to interchange the values stored in memory cells 2 and 3. What is wrong
with the following sequence of steps:
Step 1. Move the contents of cell number 2 to cell number 3.
Step 2. Move the contents of cell number 3 to cell number 2.
Design a sequence of steps that correctly interchanges the contents of these cells. If needed,
you may use additional cells.
3. How many bits would be in the memory of a computer with 4KB memory?

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

1.3 Mass Storage


1. What is gained by increasing the rotation speed of a disk or CD?
2. When recording data on a multiple-disk storage system, should we fill a complete disk
surface before starting on another surface, or should we first fill an entire cylinder before
starting on another cylinder?
3. Why should the data in a reservation system that is constantly being updated be stored on a
magnetic disk instead of a CD or DVD?
4. Sometimes, when modifying a document with a word processor, adding text does not
increase the apparent size of the file in mass storage, but at other times the addition of a
single symbol can increase the apparent size of the file by several hundred bytes. Why?
5. What advantage do flash drives have over the other mass storage systems introduced in this
section?
6. What is a buffer?

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.

1.4 Representing Information as Bit Patterns


1. Here is a message encoded in ASCII using 8 bits per symbol. What does it say?
01000011 01101111 01101101 01110000 01110101 01110100
01100101 01110010 00100000 01010011 01100011 01101001
01100101 01101110 01100011 01100101
2. In the ASCII code, what is the relationship between the codes for an uppercase letter and the
same letter in lowercase? (See Appendix A.)
3. Encode these sentences in ASCII:
a. “Stop!” Cheryl shouted. b. Does 2 + 3 = 5?
5. Convert each of the following binary representations to its equivalent base ten form:
a. 0101 b. 1001 c. 1011
d. 0110 e. 10000 f. 10010
6. Convert each of the following base ten representations to its equivalent binary form:
a. 6 b. 13 c. 11
d. 18 e. 27 f. 4
7. What is the largest numeric value that could be represented with three bytes if each digit
were encoded using one ASCII pattern per byte? What if binary notation were used?
8. An alternative to hexadecimal notation for representing bit patterns is dotted decimal
notation in which each byte in the pattern is represented by its base ten equivalent. In turn,
these byte representations are separated by periods. For example, 12.5 represents the pattern

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

Section 1.6 Storing Integers


ANSWERS
1. a. 3 b. 15 c. -4 d.-6 e.0 f.-16
2. a. 00000110 b. 11111010 c. 11101111
d. 00001101 e. 11111111 f. 00000000
3. a. 11111111 b. 10101011 c. 00000100
d. 00000010 e. 00000000 f. 10000001
4. a. With 4 bits the largest value is 7 and the smallest is -8.
b. With 6 bits the largest value is 31 and the smallest is -32.
c. With 8 bits the largest value is 127 and the smallest is -128.
5. a. 0111 (5 + 2 = 7) b. 0100 (3 + 1 = 4) c. 1111 (5 + (-6) =1)
d. 0001 (-2 + 3 = 1) e. 1000 (-6 + (-2) = -8)
6. a. 0111 b. 1011 (overflow) c. 0100 (overflow)
6|Page
d. 0001 e. 1000 (overflow)
7. a. 0110 b. 0011 c. 0100 d. 0010 e. 0001
+0001 +1110 +1010 + 0100 +1011
0111 0001 1110 0110 1100
8. No. Overflow occurs when an attempt is made to store a number that is too large for the
system being used. When adding a positive value to a negative value, the result must be
between the values being added. Therefore, the result will be small enough to be stored without
error.
9. a. 6 because 1110 → 14 - 8
b. -1 because 0111 → 7- 8
c. 0 because 1000 → 8 - 8
d. -6 because 0010 → 2 - 8
e. -8 because 0000 → 0 - 8
f. 1 because 1001 → 9 - 8
10. a. 1101 because 5 + 8 = 13 → 1101
b. 0011 because -5 + 8 = 3 → 0011
c. 1011 because 3 + 8 = 11 → 1011
d. 1000 because 0 + 8 = 8 → 1000
e. 1111 because 7 + 8 = 15 → 1111
f. 0000 because -8 + 8 = 0 → 0000
11. No. The largest value that can be stored in excess eight notation is 7, represented by 1111.
To represent a larger value, at least excess 16 (which uses patterns of 5 bits) must be used.
Similarly, 6 cannot be represented in excess four notation. (The largest value that can be
represented in excess four notation is 3.)

Section 1.7 Storing Fractions


ANSWERS
1. a. 5⁄8 b. 3(1⁄4) c. 9⁄32 d. -1(1⁄2) e. - (11⁄64)
2. a. 01101011 b. 01111010 (truncation error)
c. 01001100 d. 11101110 e. 11111000 (truncation error)
3. 01001001 (9⁄16) is larger than 00111101 (13⁄32). The following is a simple way of
determining which of two patterns represents the larger value:
Case 1. If the sign bits are different, the larger is the one with 0 sign bit.

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

You might also like