Which of the file organization methods can be accessed both randomly and sequentially?
Answer Details
The file organization method that can be accessed both randomly and sequentially is the Indexed Sequential Files.
Indexed Sequential Files use an index to organize data records, allowing for both sequential and random access. The records are stored in sequence based on a primary key field, and the index keeps track of the location of each record. This allows for sequential access by reading the records in order, or random access by searching for a specific record based on its key value.
For example, imagine a library catalog that is organized using an Indexed Sequential File. The books in the library are stored in order by their call numbers (i.e., the primary key field), and an index is kept that maps each call number to its location in the library. A patron could browse the catalog sequentially by looking at each book in order, or they could search for a specific book by using the index to find its location.
Overall, Indexed Sequential Files provide the flexibility of both sequential and random access, making them a popular choice for applications that require both types of access.