Chapter 1: Computer Systems: Solutions
Chapter 1: Computer Systems: Solutions
Chapter 1: Computer Systems: Solutions
Solutions
Multiple Choice
Solutions
1. c
2. b
3. d
4. e
5. a
6. c
7. b
8. e
True/False
Solutions
1. F
2. T
3. T
4. T
5. F
6. T
7. F
8. T
9. F
10. F
Describe the hardware components of your personal computer or of a computer in a lab to which you have
access. Include the processor type and speed, storage capacities of main and secondary memory, and types of
I/O devices. Explain how you determined your answers.
Processor:
AMD Athlon
800 MHz
Primary Memory:
256 MB of RAM
Secondary Memory
40 GB hard drive
CD-R drive
CompactFlash card reader/writer
Floppy drive
I/O Devices:
Keyboard
Mouse
Monitor
Speakers
Modem
HP PhotoSmart 1115 printer
HP LaserJet 1200 printer
HP ScanJet 4400c scanner
To find the processor and memory information, I accessed the System Information
from the control panel. To find the I/O devices, I looked in the device manager.
1.2.
S1
S2
Devices that store and move information are less expensive and more reliable if
they have to represent only one of two possible values.
1.3.
If a language uses 240 unique letters and symbols, how many bits would be needed to store each character of a
document? Why?
8 bits are needed to store each character of a document written in a language of
240 unique characters and symbols. 7 bits would be sufficient for only 128
different characters. 8 bits is sufficient for 256 different characters. Because
240 is greater than 128, but not greater than 256, at least 8 bits are needed if
all characters are represented by the same number of bits.
1.4.
Explain the difference between random-access memory (RAM) and read-only memory (ROM).
Both RAM and ROM are random access devices.
but ROM can be only read from.
1.5.
Explain the differences between a local-area network (LAN) and a wide-area network (WAN). What is the
relationship between them?
A LAN is designed to span a short distance and to connect a relatively small
number of computers. A WAN connects two or more LANs, typically across long
distances.
1.6.
What is the total number of communication lines needed for a fully connected point-to-point network of eight
computers? Nine computers? Ten computers? What is a general formula for determining this result?
Eight computers: 28 communication lines
Nine computers: 36 communication lines
Ten computers: 45 communication lines
General formula for n computers: n(n-1)/2, which represents the sum of the numbers
between 1 and n-1
1.7.
Give examples of the two types of Java comments and explain the differences between them.
One kind of comment begins with a double slash (//) and continues to the end of
the line. A second kind of comment begins following an initiating slash-asterisk
(/*) and terminates immediately preceding a terminating asterisk-slash (*/). The
second type of comment can span multiple lines.
1.8.
Why are the following valid Java identifiers not considered good identifiers?
Q is a meaningless name
TotVal
theNextValueInTheList
1.9.
Categorize each of the following situations as a compile-time error, run-time error, or logical error.
a logical error
dividing by zero
a run-time error
S3
a compile-time error
a logical error
a logical error
a compile-time error
1.10.
How many bits are needed to store a color picture that is 400 pixels wide and 250 pixels high? Assume color is
represented using the RGB technique described in this chapter and that no special compression is done.
Allowing 8 bits for each of the 3 (red, green, and blue) color components of each
of 400 x 250 pixels comprising the picture means that 8 x 3 x 400 x 250 =
2,400,000 bits are needed.
S4
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
1.3 Info
//********************************************************************
// Info.java
Author: Lewis/Loftus/Cocking
//
// Solution to Programming Project 1.3
//********************************************************************
public class Info
{
//----------------------------------------------------------------// Prints information about the programmer.
//----------------------------------------------------------------public static void main (String args[])
{
System.out.println("Name
: Lara");
System.out.println("Birthday : March 25");
System.out.println("Hobbies : Sailing, Cooking, Hiking");
System.out.println("Favorite Book
: The Brothers Karamasov");
System.out.println("Favorite Movies : Remains of the Day");
}
}
1.4 Knowledge
//********************************************************************
2007 Pearson Education
// Knowledge.java
Author: Lewis/Loftus/Cocking
//
// Solution to Programming Project 1.4
//********************************************************************
class Knowledge
{
//----------------------------------------------------------------// Prints a phrase in various configurations.
//----------------------------------------------------------------public static void main (String[] args)
{
System.out.println ();
System.out.println ("Knowledge is Power");
System.out.println ();
System.out.println ();
System.out.println ("Knowledge");
System.out.println ("
is");
System.out.println (" Power");
System.out.println ();
System.out.println ();
System.out.println ("==========================");
System.out.println ("|
|");
System.out.println ("|
Knowledge is Power
|");
System.out.println ("|
|");
System.out.println ("==========================");
System.out.println ();
}
}
1.5 Diamond
//********************************************************************
// Diamond.java
Author: Lewis/Loftus/Cocking
//
// Solution to Programming Project 1.5
//********************************************************************
public class Diamond
{
//----------------------------------------------------------------// Prints a diamond
//----------------------------------------------------------------public static void main (String args[])
{
System.out.println("
*");
System.out.println("
***");
System.out.println(" *****");
System.out.println(" *******");
System.out.println("*********");
System.out.println(" *******");
System.out.println(" *****");
System.out.println("
***");
System.out.println("
*");
}
}
1.6 Initials
//********************************************************************
// Initials.java
Author: Lewis/Loftus/Cocking
//
// Solution to Programming Project 1.6
//********************************************************************
class Initials
2007 Pearson Education
S5
S6
{
//----------------------------------------------------------------// Prints some initials in block letters.
//----------------------------------------------------------------public static void main (String[] args)
{
System.out.println ();
System.out.println ("JJJJJJJJJJJ
A
LLL");
System.out.println ("JJJJJJJJJJJ
AAA
LLL");
System.out.println ("
JJJ
AA AA
LLL");
System.out.println ("
JJJ
AA
AA
LLL");
System.out.println ("
JJJ
AA
AA
LLL");
System.out.println ("
JJJ
AAAAAAAAA
LLL");
System.out.println ("
JJJ
AAAAAAAAA
LLL");
System.out.println ("JJ
JJJ
AA
AA
LLL");
System.out.println ("JJJJJJJJ
AA
AA
LLLLLLLLLL");
System.out.println ("JJJJJJJJ
AA
AA
LLLLLLLLLL");
System.out.println ();
}
}