Chapter 2

Computer Science: An Overview · 24 exercises

Problem 1

a. In what way are general-purpose registers and main memory cells similar? b. In what way do general-purpose registers and main memory cells differ?

4 step solution

Problem 3

Suppose a block of data is stored in the memory cells of the Vole from address \(0 \mathrm{x} 98\) to \(0 \mathrm{xA} 2\), inclusive. How many memory cells are in this block? List their addresses.

3 step solution

Problem 8

Suppose a machine language is designed with an op-code field of 4 bits. How many different instruction types can the language contain? What if the op-code field is increased to 6 bits?

5 step solution

Problem 21

Suppose the memory cells at addresses \(0 x A F\) through \(0 \mathrm{xB} 1\) in the Vole contain the following bit patterns: \(\begin{array}{cc}\text { Address } & \text { Contents } \\ \text { 0xAF } & \text { 0xB0 } \\ \text { 0xB0 } & \text { 0xB0 } \\ \text { 0xB1 } & \text { 0xAF }\end{array}\) What would happen if we started the machine with its program counter containing \(0 \mathrm{xAF}\) ?

6 step solution

Problem 23

In each of the following cases, write a short program in Vole to perform the requested activities. Assume that each of your programs is placed in memory starting at address \(0 \times 00\). a. Move the value at memory location \(0 x D 8\) to memory location \(0 \mathrm{xB} 3\). b. Interchange the values stored at memory locations \(0 \times D 8\) and \(0 \times B 3\). c. If the value stored in memory location \(0 x 44\) is \(0 x 00\), then place the value \(0 x 01\) in memory location \(0 \mathrm{x} 46\); otherwise, put the value \(0 \mathrm{xFF}\) in memory location \(0 x 46\).

4 step solution

Problem 35

Identify both the mask and the logical operation needed to accomplish each of the following objectives: a. Put \(1 \mathrm{~s}\) in the upper 4 bits of an 8-bit pattern without disturbing the other bits. b. Complement the most significant bit of an 8 -bit pattern without changing the other bits. c. Complement a pattern of 8 bits. d. Put a 0 in the least significant bit of an 8-bit pattern without disturbing the other bits. e. Put \(1 \mathrm{~s}\) in all but the most significant bit of an 8-bit pattern without disturbing the most significant bit. f. Filter out all of the green color component from an RGB bitmap image pixel in which the middle 8 bits of a 24 -bit pattern store the green information. g. Invert all of the bits in a 24-bit RGB bitmap pixel. h. Set all the bits in a 24-bit RGB bitmap pixel to 1 , indicating the color white.

8 step solution

Problem 37

Identify a logical operation (along with a corresponding mask) that, when applied to an input string of 8 bits, produces an output string of all 0 s if and only if the input string is 10000001 .

5 step solution

Problem 39

Describe a sequence of logical operations (along with their corresponding masks) that, when applied to an input string of 8 bits, produces an output byte of all 0 s if the input string both begins and ends with 1s. Otherwise, the output should contain at least one 1 .

5 step solution

Problem 42

What would be the result of performing a 2-bit right circular shift on the following bytes represented in hexadecimal notation? (Give your answers in hexadecimal notation.) a. \(0 \times 3 \mathrm{~F}\) b. \(0 \times 0 \mathrm{D}\) c. \(0 \mathrm{xFF}\) d. \(0 \times 77\)

4 step solution

Problem 44

Write a Vole program that reverses the contents of the memory cell at address \(0 x 8 C\). (That is, the final bit pattern at address \(0 \times 8 \mathrm{C}\) when read from left to right should agree with the original pattern when read from right to left.)

6 step solution

Problem 45

Write a Vole program that subtracts the value stored at \(0 \mathrm{xA} 1\) from the value stored at address \(0 \mathrm{xA} 2\) and places the result at address \(0 \mathrm{xA} 0\). Assume that the values are encoded in two's complement notation.

5 step solution

Problem 46

High-definition video can be delivered at a rate of 30 frames per second (fps), where each frame has a resolution of 1920 x 1080 pixels using 24 bits per pixel. Can an uncompressed video stream of this format be sent over a USB \(1.1\) serial port? USB \(2.0\) serial port? USB \(3.0\) serial port? (Note: The maximum speeds of USB 1.1, USB 2.0, and USB \(3.0\) serial ports are \(12 \mathrm{Mbps}\), \(480 \mathrm{Mbps}\), and \(5 \mathrm{Gbps}\), respectively.)

6 step solution

Problem 47

Suppose a person is typing forty words per minute at a keyboard. (A word is considered to be five characters.) If a machine executes 500 instructions every microsecond (millionth of a second), how many instructions does the machine execute during the time between the typing of two consecutive characters?

4 step solution

Problem 48

How many bits per second must a keyboard transmit to keep up with a typist typing forty words per minute? (Assume each character is encoded in ASCII and each word consists of six characters.)

4 step solution

Problem 50

Suppose a machine has 200 GB of storage space available on a hard disk and receives data over a broadband connection at the rate of \(15 \mathrm{Mbps}\). At this rate, how long will it take to fill the available storage space?

4 step solution

Problem 51

Suppose a machine has 200 GB of storage space available on a hard disk and receives data over a broadband connection at the rate of \(15 \mathrm{Mbps}\). At this rate, how long will it take to fill the available storage space?

3 step solution

Problem 52

Suppose a satellite system is being used to receive a serial data stream at \(250 \mathrm{Kbps}\). If a burst of atmospheric interference lasts \(6.96\) seconds, how many data bits will be affected?

3 step solution

Problem 53

Suppose you are given 32 processors, each capable of finding the sum of two multidigit numbers in a millionth of a second. Describe how parallel processing techniques can be applied to find the sum of 64 numbers in only sixmillionths of a second. How much time does a single processor require to find this same sum?

9 step solution

Problem 54

Summarize the difference between a CISC architecture and a RISC architecture.

5 step solution

Problem 55

Identify two approaches to increasing throughput.

3 step solution

Problem 56

Describe how the average of a collection of numbers can be computed more rapidly with a multiprocessor machine than a single processor machine.

5 step solution

Problem 57

Write and test a Python script that reads in a floating-point radius of a circle, and outputs the circumference and area of the circle.

6 step solution

Problem 58

Write and test a Python script that reads in a character string and an integer, and outputs the character string repeated the number of times given by the integer.

4 step solution

Problem 59

Write and test a Python script that reads in two floating-point side lengths of a right triangle, and outputs the hypotenuse length, perimeter, and area.

6 step solution

Show/ page