Chapter 9 Outcomes
Records, Unions and Sets
Knowledge Outcomes
Define each of the key terms listed in the chart below.
| record | union | set |
| field | type | bind |
| key | swap procedure | 2D array of records |
| binary files | text files | skip |
| random access files | sequential files | read, write, mod |
| seek, tell | union type | tag |
| enumerated type | enum | subrange type |
| variant | base type | set of |
| all | cardinality | empty set |
| intersection operator | union operator | difference operator |
Show how to define a variable using the type declaration (9.1).
Create an array of records and be able to input and output values to fields of each record in the array (9.2).
Explain possible difficulties when storing and retrieving string items by field (9.2).
Discuss the importance of a key field to records (9.3).
Explain the advantage of being able to move or copy one entire record from one memory location to another (9.3).
Describe the basic principle behind the swap procedure involving two records in an array (9.3).
Describe the basic principles involved in generating a deck of cards and subsequently shuffling the deck (9.3).
Explain how a two-dimensional array is used to both deal and output the deck of cards once it has been generated and shuffled (9.3).
Describe the differences between text files and binary files with respect to the store and retrieve operations that are used (9.4).
Explain the difference between how text files and binary files encode and store information on disks (9.4).
Discuss the advantage of using fixed length records when storing or retrieving binary files (9.4).
Discuss the advantage of using variable length records when storing or retrieving text files (9.4).
Explain the purpose of seek and tell when using binary files (9.4).
Explain why a directory file must be maintained when using binary files (9.4).
Explain the purpose of the skip instruction when used in a get statement while reading binary files (9.4).
Describe the difference between a record type and a union type (9.5).
Explain the purpose of the tag statement when using the union type (9.5).
Describe the relationship between the set type and the variables which are declared based on sets (9.6).
Identify the set relation operator symbols (9.6):
Identify the set operation symbols (9.6):
Describe how sets can be used to output a card hand from a shuffled deck in its proper order (9.6).
Skills Outcomes
Create a record template using the type statement (9.1).
Properly assign values to record fields (9.1).
Show how to add format items to string information so as to store and retrieve by fields (9.2).
Properly create and use the bind construct (9.2).
Create binary files and access them for both read and write operations (9.4).