Page 58 - Introduction to Programming with Java: A Problem Solving Approach
P. 58
24
Chapter 1 Introduction to Computers and Programming
13.
[after §1.8] Experiment with the Hello.java program to learn the meanings of typical compilation and runtime error messages:
a) Omit the final / from the header block.
b) Omit any part of the argument in the parentheses after main.
c) Omit the semicolon from the end of the output statement. d) One at a time, omit the braces—{ and }.
e) Try using lowercase, $, _, or a number for the first character in the class name. f) Make the program filename different from the class name.
g) Change main to Main.
h) One at a time, try omitting public, static, and void from before main.
[after §1.8] Learn how to use TextPad by working your way through the “Getting Started with TextPad” tutorial on the book’s Web site. Submit hardcopy of the source code for your Countdown program (i.e., print your program from within TextPad). Note that you’re not required to submit source code for your Hello World program or submit output for either program.
14.
Review Question Solutions
1. What do the following abbreviations mean?
a) I/O: input/output devices.
b) CPU: central processing unit or processor.
c) RAM: random access memory or main memory.
d) GHz: Gigahertz billions of cycles per second.
e) MB: MegaBytes millions of bytes, where one byte is 8 bits, and one bit is the answer to a single yes/
no question.
Apago PDF Enhancer
2. The keyboard and a mouse are the two most obvious examples of input devices. Another possible input device is a telephone modem.
3. The display screen and a printer are the two most obvious examples of important output devices. Other examples are a telephone modem and speakers.
4. Assertions:
a) True. Main memory is physically closer to the processor, and the bus that connects the main memory to
the processor is faster than the bus that connects the auxiliary memory to the processor. Main memory
is also more expensive and therefore usually smaller.
b) False. When power goes off, main memory loses its information, while auxiliary memory does not. An
unexpected power failure might corrupt information in auxiliary memory, however.
c) False. The first position in main memory is at address 0.
d) False. The CPU is considered to be part of the computer itself; it’s not a peripheral device.
e) True. Hot swapping is when you plug a device into a computer while the computer is on.
5. An algorithm is a step-by-step procedure for solving a problem.
6. Pseudocode is an informal language that uses regular English terms to describe a program’s steps.
7. Syntax rules are more lenient for pseudocode (as opposed to programming language code).
8. Most compilers convert source code to object code. Java compilers convert source code to bytecode.
9. Object code is the formal term for binary-format instructions that a processor can read and understand.
10. A Java Virtual Machine (JVM) is an interpreter that translates Java bytecode into object code.
11. Five different types of Java Programs are applets, servlets, JSP pages, micro edition applications, and
standard edition applications.