|
|
|
|
|
|
|
Answers to Selected Exercises |
|
|
|
|
|
|
|
|
Chapter 1
Exam Preparation Exercises |
|
|
|
|
|
|
|
|
2. Input: Source code file (program in a high-level language such as C++) |
|
|
|
|
|
|
|
|
Output: Object code file (machine-language program). Some compilers also output a listing (a copy of the program with error messages and other information inserted). |
|
|
|
|
|
|
|
|
4. The following are peripheral devices: disk drive, magnetic tape drive, printer, CD-ROM drive, auxiliary storage, terminal, and mouse. The arithmetic/logic unit, |
|
|
|
|
|
|
|
|
the memory, and the control unit are not peripherals. |
|
|
|
|
|
|
|
|
Chapter 1
Case Study Follow-Up |
|
|
|
|
|
|
|
|
1. There are many valid solutions to this question. Here is one way of dividing the problem: |
|
|
|
|
|
|
|
|
Chapter 2
Exam Preparation Exercises |
|
|
|
|
|
|
|
|
1. a. invalid b. valid c. valid d. invalid e. valid f. invalid g. valid h. invalid |
|
|
|
|
|
|
|
|
4. program15; algorithm14; compiler3; identifier1; compilation phase12; execution phase10; variable11; constant2; memory13; syntax6; semantics8; block7 |
|
|
|
|
|
|
|
|
5. a. Integer: 13 b. Floating point:-15.6 c. Floating point: 3.33333 d. Integer: 3 e. Integer: 1 f. Illegal: Both operands of the % operator must be of integer type. g. Integer: 0 |
|
|
|
|
|
|
|
|
7. a. reserved b. programmer-defined c. programmer-defined d. reserved e. programmer-defined |
|
|
|
|
|