Chapter 2 RQ
Chapter 2 RQ
13. Suppose the memory cells at addresses 00 a. What will be in the memory cell at address
through 02 in the machine described in 00 when the machine halts?
Appendix C contain the following bit patterns: b. What bit pattern will be in the program
Address Contents counter when the machine halts?
00 12 16. Suppose the memory cells at addresses 00
01 21 through 07 in the machine described in
02 34 Appendix C contain the following bit patterns:
a. What would be the first instruction exe- Address Contents
cuted if we started the machine with its 00 2B
program counter containing 00? 01 07
b. What would be the first instruction exe- 02 3B
cuted if we started the machine with its 03 06
program counter containing 01? 04 C0
14. Suppose the memory cells at addresses 00 05 00
through 05 in the machine described in 06 00
Appendix C contain the following bit patterns: 07 23
18. Suppose the memory cells at addresses F0 21. Suppose the memory cells at addresses AF
through FD in the machine described in through B1 in the machine described in
Appendix C contain the following (hexadeci- Appendix C contain the following bit patterns:
mal) bit patterns: Address Contents
Address Contents AF B0
F0 20 B0 B0
F1 00 B1 AF
F2 22
What would happen if we started the machine
F3 02
with its program counter containing AF?
F4 23
F5 04 22. Suppose the memory cells at addresses 00
F6 B3 through 05 in the machine described in
F7 FC Appendix C contain the following (hexadeci-
F8 50 mal) bit patterns:
F9 02 Address Contents
FA B0 00 25
FB F6 01 B0
FC C0 02 35
FD 00 03 04
04 C0
If we start the machine with its program
05 00
counter containing F0, what is the value in
register 0 when the machine finally executes If we start the machine with its program counter
the halt instruction at location FC? containing 00, when does the machine halt?
19. If the machine in Appendix C executes an 23. In each of the following cases, write a short
instruction every microsecond (a millionth of program in the machine language described in
a second), how long does it take to complete Appendix C to perform the requested activi-
the program in Problem 18? ties. Assume that each of your programs is
20. Suppose the memory cells at addresses 20 placed in memory starting at address 00.
through 28 in the machine described in a. Move the value at memory location D8 to
Appendix C contain the following bit patterns: memory location B3.
b. Interchange the values stored at memory
Address Contents locations D8 and B3.
20 12 c. If the value stored in memory location 44 is
21 20 00, then place the value 01 in memory loca-
22 32 tion 46; otherwise, put the value FF in
23 30 memory location 46.
24 B0
25 21 24. A game that used to be popular among com-
26 24 puter hobbyists is core wars—a variation of
27 C0 battleship. (The term core originates from an
28 00 early memory technology in which 0s and 1s
were represented as magnetic fields in little
Assume that the machine starts with its pro- rings of magnetic material. The rings were
gram counter containing 20. called cores.) The game is played between two
a. What bit patterns will be in registers 0, 1, opposing programs, each stored in different
and 2 when the machine halts? locations of the same computer’s memory.
b. What bit pattern will be in the memory cell The computer is assumed to alternate
at address 30 when the machine halts? between the two programs, executing an
c. What bit pattern will be in the memory cell instruction from one followed by an instruc-
at address B0 when the machine halts? tion from the other. The goal of each program
Chapter Review Problems 105
*34. Perform the indicated operations: accomplish a 5-bit right circular shift of
a. 111001 b. 000101 register B?
AND 101001 AND 101010 b. What single instruction in the machine lan-
guage of Appendix C could be used to accom-
c. 001110 d. 111011
plish a 2-bit left circular shift of register B?
AND 010101 AND 110111
*41. Write a program in the machine language of
e. 111001 f. 010100 Appendix C that reverses the contents of the
OR 101001 OR 101010 memory cell at address 8C. (That is, the final
g. 000100 h. 101010 bit pattern at address 8C when read from left
OR 010101 OR 110101 to right should agree with the original pat-
tern when read from right to left.)
i. 111001 j. 000111
XOR 101001 XOR 101010 *42. Write a program in the machine language of
Appendix C that subtracts the value stored at
k. 010000 l. 111111 A1 from the value stored at address A2 and
XOR 010101 XOR 110101 places the result at address A0. Assume that
*35. Identify both the mask and the logical opera- the values are encoded in two’s complement
tion needed to accomplish each of the follow- notation.
ing objectives: *43. High definition video can be delivered at a
a. Put 1s in the upper4 bits of an 8-bit pat- rate of 30 frames per second (fps) where each
tern without disturbing the other bits. frame has a resolution of 1920 1080 pixels
b. Complement the most significant bit of an using 24 bits per pixel. Can an uncompressed
8-bit pattern without changing the other bits. video stream of this format be sent over a
c. Complement a pattern of 8 bits. USB 1.1 serial port? USB 2.0 serial port?
d. Put a 0 in the least significant bit of an 8-bit USB 3.0 serial port? (Note: The maximum
pattern without disturbing the other bits. speeds of USB 1.1, USB 2.0, and USB 3.0 serial
e. Put 1s in all but the most significant bit of ports are 12Mbps, 480Mbps, and 5Gbps
an 8-bit pattern without disturbing the respectively.)
most significant bit. *44. Suppose a person is typing forty words per
*36. Identify a logical operation (along with a corre- minute at a keyboard. (A word is considered
sponding mask) that, when applied to an input to be five characters.) If a machine executes
string of 8 bits, produces an output string of all 500 instructions every microsecond (millionth
0s if and only if the input string is 10000001. of a second), how many instructions does the
machine execute during the time between the
*37. Describe a sequence of logical operations
typing of two consecutive characters?
(along with their corresponding masks) that,
when applied to an input string of 8 bits, pro- *45. How many bits per second must a keyboard
duces an output byte of all 0s if the input string transmit to keep up with a typist typing forty
both begins and ends with 1s. Otherwise, the words per minute? (Assume each character is
output should contain at least one 1. encoded in ASCII and each word consists of
six characters.)
*38. What would be the result of performing a 4-bit
left circular shift on the following bit patterns? *46. Suppose the machine described in Appendix
a. 10101 b. 11110000 c. 001 C communicates with a printer using the
d. 101000 e. 00001 technique of memory-mapped I/O. Suppose
also that address FF is used to send characters
*39. What would be the result of performing a to the printer, and address FE is used to
2-bit right circular shift on the following receive information about the printer’s status.
bytes represented in hexadecimal notation In particular, suppose the least significant bit
(give your answers in hexadecimal notation)? at the address FE indicates whether the
a. 3F b. 0D printer is ready to receive another character
c. FF d. 77 (with a 0 indicating “not ready” and a 1 indi-
*40. a. What single instruction in the machine cating “ready”). Starting at address 00, write a
language of Appendix C could be used to machine language routine that waits until the
Social Issues 107
printer is ready for another character and *50. Suppose you are given 32 processors, each
then sends the character represented by the capable of finding the sum of two multidigit
bit pattern in register 5 to the printer. numbers in a millionth of a second. Describe
*47. Write a program in the machine language how parallel processing techniques can be
described in Appendix C that places 0s in all applied to find the sum of 64 numbers in
the memory cells from address A0 through C0 only six-millionths of a second. How much
but is small enough to fit in the memory cells time does a single processor require to find
from address 00 through 13 (hexadecimal). this same sum?
*48. Suppose a machine has 200 GB of storage *51. Summarize the difference between a CISC
space available on a hard disk and receives architecture and a RISC architecture.
data over a broadband connection at the rate *52. Identify two approaches to increasing
of 15 Mbps. At this rate, how long will it take throughput.
to fill the available storage space? *53. Describe how the average of a collection of
*49. Suppose a satellite system is being used to numbers can be computed more rapidly with
receive a serial data stream at 250 Kbps. If a a multiprocessor machine than a single-
burst of atmospheric interference lasts 6.96 sec- processor machine.
onds, how many data bits will be affected?
Social Issues
The following questions are intended as a guide to the ethical/social/legal issues
associated with the field of computing. The goal is not merely to answer these
questions. You should also consider why you answered as you did and whether
your justifications are consistent from one question to the next.
1. Suppose a computer manufacturer develops a new machine architecture. To
what extent should the company be allowed to own that architecture? What
policy would be best for society?
2. In a sense, the year 1923 marked the birth of what many now call planned
obsolescence. This was the year that General Motors, led by Alfred Sloan,
introduced the automobile industry to the concept of model years. The idea
was to increase sales by changing styling rather than necessarily introducing
a better automobile. Sloan is quoted as saying, “We want to make you dissat-
isfied with your current car so you will buy a new one.” To what extent is this
marketing ploy used today in the computer industry?
3. We often think in terms of how computer technology has changed our society.
Many argue, however, that this technology has often kept changes from occur-
ring by allowing old systems to survive and, in some cases, become more
entrenched. For example, would a central government’s role in society have
survived without computer technology? To what extent would centralized
authority be present today had computer technology not been available? To
what extent would we be better or worse off without computer technology?
4. Is it ethical for an individual to take the attitude that he or she does not need
to know anything about the internal details of a machine because someone
else will build it, maintain it, and fix any problems that arise? Does your
answer depend on whether the machine is a computer, automobile, nuclear
power plant, or toaster?
5. Suppose a manufacturer produces a computer chip and later discovers a flaw
in its design. Suppose further that the manufacturer corrects the flaw in
future production but decides to keep the original flaw a secret and does not