CHAPTER 13 File Structures

advertisement
CHAPTER 13
File Structures
Review Questions
1. A file is an external collection of related data treated as a unit. The primary purpose of a file is to store data.
2. Sequential access and random access
3. We need an EOF marker at the end of a sequential file so that we know when we
reach the end of the file during processing.
4. The old master file is the file that should be updated while the new master file contains the current data (the data from the old master file including any changes that
were made during the update).
5. The transaction file contains any changes that should be made to the old master
file.
6. Solution may vary.
7. Solution may vary.
8. The address is the position within the file where the needed information is stored.
9. The index stores a table that relates the keys of the data items to the addresses in
the file where the data are stored.
10. In direct hashing, the key is the address without any algorithmic manipulation.
11. In modulo division hashing, the key is divided by the file size and the remainder
plus 1 is used as the address of the data.
12. In digit extraction hashing, certain digits are removed from the key and used as the
address of the data.
13. A collision is an event that occurs when a hashing algorithm produces an address
for an insertion and that address is already occupied.
14. Open addressing, linked list resolution, and bucket hashing
15. In open addressing, the prime area is searched for an unoccupied address.
16. The prime area is where all of the home addresses are stored while the overflow
area is where any collisions are stored.
3
4
CHAPTER 13
FILE STRUCTURES
17. A text file is a file of characters while a binary file is a collection of data stored in
the internal format of the computer.
Multiple-Choice Questions
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
d
a
a
d
c
a
a
a
c
b
d
a
b
d
b
a
c
a
d
d
a
c
b
a
Exercises
42.
New Master:
14 John Wu 17.00
16 George Brown 18.00
17 Duc Lee 11.00
26 Ted White 23.00
31 Joanne King 28.00
89 Mark Black 19.00
92 Betsy Yellow 14.00
SECTION
Error File:
Key 17 already used
Key 89 already used
43.
Index file:
123453 001
114237 002
156734 003
093245 004
077654 005
256743 006
423458 007
44.
a.
b.
c.
d.
6
15
3
8
a.
b.
c.
d.
164
625
956
409
a.
b.
c.
d.
36
69
62
47
45.
46.
47.
a. 106
b. 89
c. 171
d. 114
48. See Figure 13.1.
49. See Figure 13.2.
5
6
CHAPTER 13
FILE STRUCTURES
Figure 13.1 Exercise 48
003
004
005
08222
10278
20553
406
17256
Figure 13.2 Exercise 49
003
004
005
08222
10278
406
17256
20553
Download