You are on page 1of 2

➢ What is File?

A file is a named collection of data or information stored on a computer's storage


system.

➢ What is File Accessing Method?


File accessing methods are techniques used to read from or write to files, determining
how data is retrieved or stored within the file.

➢ Types of File Accessing Methods

1. Sequential Access Method:


- Data is accessed or processed sequentially from the beginning to the end of a file.
- It involves reading or writing data in a linear manner, one after the other.
- Each read or write operation starts from the current position and moves to the next
position.
- It is useful when data needs to be processed in a specific order or when the file is
accessed sequentially, such as reading lines from a text file.
- However, accessing specific data in large files can be time-consuming as the entire
file needs to be traversed.

2. Direct Access Method:


- Data is accessed randomly or directly without the need to traverse the entire file.
- Each record or block within the file has a unique identifier or address, allowing
direct access.
- Reading or writing operations can occur at any position within the file using the
address.
- It is suitable for situations where data retrieval or modification needs to occur at
arbitrary positions, like in databases.
- Direct access can be faster than sequential access for accessing specific data but
requires an efficient indexing mechanism.

3. Indexed Access Method:


- An index is created to store the addresses or pointers of specific data within a file.
- The index maps the key or search criteria to the corresponding addresses.
- To access a record, the index is first consulted to determine its location in the file.
- Once the address is obtained, direct access can be performed.
- It combines the benefits of direct access with the ability to locate data efficiently
based on the index.
- Indexed access is commonly used in file systems and databases to enable efficient
search and retrieval operations.

You might also like