Answers to Chapter 16 Review Questions -------------------------------------- 1. A record is a collection of unordered, heterogeneous values that has conceptual integrity as a single unit: a field is any of the values that make up that collection. C programmers often refer to these concepts as structures and members, respectively. 2. True 3. False, the types of each field in a record can be different, but need not be. 4. Before you declare a record variable, you must first define a new structure type representing the record. After doing so, you can then declare variables of that new type. 5. The . operator (pronounced dot) is used to select a field from a record. 6. True 7. True 8. Cratchit's salary: staff[1].salary Scrooge's first initial: staff[0].name[0] 10. The three factors that influence the decision as whether a type should be declared as a record or as a pointer to a record are: - The size of the record type - The cost of memory allocation - The discipline used by functions that manipulate that type 12. The expression *p.cost has the wrong operator precedence to achieve the desired effect. As written, the dot operator is applied first, followed by the asterisk; what you ordinarily want is to have these operators applied in the opposite order. To simplify this combined operation of dereference and selection, C provides the -> operator, which is illustrated by the expression p->cost 13. A database is a large collection of structured objects that can be maintained in permanent storage. 14. The external representation of the database allows it to be stored in a file system, which is often limited to ASCII text. For more convenient manipulation, however, you also need to design an internal representation that can be manipulated directly by the program. To design the external database, programmers must consider the limitations of the file storage medium and the extent to which the database should be readable by humans. For the internal database, the design is driven by the types of operations that the program needs to perform. 16. The term data-driven design refers to programs that control their entire operation on the basis of information from a database. Data-driven programs are usually shorter, more flexible, and easier to maintain than programs that incorporate the same information directly into the implementation.