A First Book of ANSI C, 4th Edition
14188-35560
Chapter 1 Solutions
Exercis 1.1
Short Answer Questions
1. A bit is the smallest and most basic data item which is a switch that can be either opened or clod. A bit can reprent the values 0 and 1.
2. A byte is a grouping of eight bits. A byte can assume 256 distinct patterns.科学定律
3. A byte us a pattern of eight bits, such as 00110011, to reprent characters in a computer.
4. A word is a single unit combination of one or more bytes. Word sizes for some common computers include: a single byte for early personal computers, such as the Apple IIe and C
ommodore machines; two bytes for the first IBM PCs; four bytes for the more current Intel-bad PCs.
5. The two principal parts of the CPU are the Control Unit and the Arithmetic and Logic Unit (ALU). The Control Unit monitors the overall operation of the computer while the ALU performs all the arithmetic and logic functions provided by the system.
6. The main difference between RAM and ROM is RAM is volatile while ROM is nonvolatile. Both RAM and ROM are random access which means that every ction of memory can be accesd randomly as quickly as any other ction.
7. a. The input/output unit is the interface that provides access to and from the computer to which peripheral devices are attached.
b. Three devices that would be connected to the input/output unit include keyboards, monitors and printers. (Plea note there are other examples the student could include.)
8. Secondary storage is a permanent storage area for programs and data. Three exampl
es of condary storage include magnetic tapes, magnetic disks and CD-ROMS. (Plea note there are other examples the student could include.)
9. The difference between quential storage and direct access storage is quential storage allows data to be written or read in one quential stream from beginning to end while direct access storages allows data to be written or read from any one file or program independent of its position on the storage medium. Direct access storage allows the computer to jump directly to the desired point in storage, rather than passing through all intervening points like quential storage would require. In other words, the data can be accesd more quickly.
10. A microprocessor is a single microchip CPU. In everyday life microprocessors are ud in notebook and desktop computers, calculators, and even digital watches. (Plea note there are other examples the student could include.)
Exercis 1.2
1. a. computer program – a lf-contained t of instructions and data ud to operate a computer to produce a specific result
b. programming – the process of developing and writing a program
c. programming language看字开头的成语 –the t of data and instructions that can be ud to construct a program
d. high-level language – languages in which the instructions remble human languages, such as English, and can be run on a variety of computer types
e. low-level language – language that us instructions that are directly tied to one type of computer
f. machine language – a programming language consisting of the binary codes the can be executed by a computer
g. asmbly language – a programming language that us symbolic names for operations and memory address
h. procedure-oriented language文献研究 – high-level language in which the instructions are only ud to create lf-contained units referred to as procedures
i. object-oriented language – high-level language which defines and manipulates objects to produce results
j. source program – program written in a computer language
k. compiler圆锥形的体积公式 – program which translates high-level languages as a complete unit before any individual statement is executed
l. asmbler – a program that converts, or translates, asmbly language programs into machine language
2. a. A high-level language can be translated to run on a variety of computer types, while a low-level language is directly tied to one type of computer.
b. Procedure-oriented languages create logically consistent ts of instructions, or proced
ures, to produce a specific result while object-oriented languages create and manipulate objects to produce specific results.
3. An asmbler translates asmbly language programs, while both compilers and interpreters translate high-level source programs. A compiler translates a high-level source programs as a complete unit before any one statement is actually executed, while an interpreter translates individual source program statements one at a time into executable statements. Each interpreted statement is executed immediately after translation.
4. a. Add the data in memory location 1 to the data in memory location 2.
木瓜如何吃Multiply the data in memory location 3 by the data in memory location 2.
Subtract the data in memory location 4 from the data in memory location 3.
Divide the data in memory location 3 by the data in memory location 5.
b. 3 + 5 = 8
6 * 3 = 18
6 – 14 = -8
6 / 4 = 1.5
5. ADD 1, 2
MUL 3, 2
牛奶燕麦片>冰箱细菌SUB 4, 3
动物装饰
DIV 3, 5
6. (10 + 20) * .6 = 18