🎓 BookMCQ
← Back to 12. File System Implementation

📝 Indexed allocation Method in File System Implementation (12 MCQs)

📖 From Operating System • 12. File System Implementation • 12 questions available

What is Indexed allocation Method in File System Implementation?

Definition:
Indexed allocation uses an index block containing an array of pointers to all data blocks, enabling direct mapping from logical to physical blocks.

Example:
Accessing logical block jj retrieves physical address via disk_addr=index_block[j]disk\_addr = index\_block[j] in one additional I/O operation.

Reason:
Combines benefits of contiguous and linked allocation by supporting both sequential and direct access without external fragmentation, though index block overhead exists for small files.

2
Easy
5
Medium
5
Hard

📝 All Indexed allocation Method in File System Implementation MCQs

Q1. What is the block that stores pointers to a file's data blocks called in indexed allocation?

A.Index block ✅
B.Superblock
C.Inode
D.Data block
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The index block contains the list of pointers that map each logical block of a file to its physical location on disk, which is the defining feature of indexed allocation. A superblock holds file system metadata, not per‑file pointers, so it is incorrect. An inode is a UNIX structure that may contain direct pointers, but the specific term for the pointer list in indexed allocation is the index block. Data blocks store actual file contents, not pointers, making them wrong choices.

Q2. How does indexed allocation enable random access to any block of a file without traversing previous blocks?

A.By storing all data sequentially
B.By using an index block that contains direct pointers to each data block ✅
C.By linking blocks in a chain
D.By allocating fixed-size segments
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Indexed allocation keeps an index block that holds a direct pointer for every logical block of the file. When a program requests block k, the system simply reads pointer k from the index block and jumps to the corresponding data block, avoiding any need to walk through earlier blocks. Storing data sequentially does not provide direct pointers, linking blocks requires traversal, and fixed‑size segments alone do not give random‑access capability.

Q3. Why is indexed allocation generally more efficient than linked allocation for large files?

A.It reduces the number of disk seeks when reading sequentially
B.It eliminates the need for a free‑space list
C.It provides direct pointers to each block, avoiding traversal ✅
D.It uses less metadata
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Indexed allocation stores an array of pointers in an index block, so the system can jump directly to any data block without following a chain of links. This eliminates the per‑block traversal cost that linked allocation incurs for large files, where many links would have to be read. Reducing seeks is a benefit but not the primary reason; free‑space lists and metadata size are unrelated to the traversal efficiency.

Q4. What is the primary overhead introduced by indexed allocation, especially for very small files?

A.Increased external fragmentation
B.Extra pointer indirection causing latency
C.Wasted space due to a full index block even if only a few pointers are used ✅
D.Higher CPU usage for maintaining linked lists
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The index block occupies an entire disk block even when only a handful of pointers are needed, leading to internal waste for tiny files. This overhead is the main drawback for small files. External fragmentation is not directly caused by the indexing structure, pointer indirection latency is modest, and maintaining linked lists is characteristic of linked allocation, not indexed allocation.

Q5. In a two‑level indexed allocation scheme, how does the size of the first‑level index block affect the maximum file size compared to a single‑level scheme?

A.It reduces the maximum size because it occupies space
B.It does not affect the maximum size; only block size matters
C.It increases the maximum size by providing more pointers through the second level ✅
D.It doubles the maximum size regardless of block size
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: A first‑level index block points to many second‑level index blocks, each of which holds additional data‑block pointers. By adding this extra level, the total number of addressable data blocks grows dramatically, allowing larger files than a single‑level scheme that is limited to the pointers that fit in one block. The space occupied does not reduce capacity, and the increase is not a simple doubling but depends on the number of pointers per block.

Q6. A file system uses indexed allocation with a block size of 4 KB and 4‑byte pointers. One index block can hold 1024 pointers. What is the maximum file size that can be addressed with a single index block?

A.4 MB ✅
B.16 MB
C.1 GB
D.4 GB
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Each pointer addresses one 4 KB data block. With 1024 pointers, the index block can reference 1024×4KB=4096KB=4MB1024 \times 4\text{KB}=4096\text{KB}=4\text{MB} of data. Therefore the maximum file size reachable with one index block is 4 MB. The other options assume more pointers or larger block sizes, which are not given. The calculation directly follows from multiplying the number of pointers by the block size.

Q7. Given a block size of 1 KB and 4‑byte pointers, each index block holds 256 pointers. If a file is 10 MB, which indexing scheme is required to store the entire file?

A.Single‑level indexed allocation
B.Three‑level indexed allocation
C.Double‑level indexed allocation ✅
D.No indexing needed
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: A 1 KB block holds 256 pointers, so one index block can address 256×1KB=256KB256 \times 1\text{KB}=256\text{KB}. A 10 MB file needs 10MB/1KB=10,24010\,\text{MB} / 1\,\text{KB}=10,240 blocks, far exceeding 256. Using a second‑level index, each first‑level pointer can refer to another index block that adds another 256 pointers, giving 256×256=65,536256 \times 256 = 65,536 blocks, enough for 10 MB. Thus double‑level indexing is required, while single‑level is insufficient and three‑level is unnecessary.

Q8. A file uses indexed allocation with a block size of 1024 bytes. To read the byte at offset 5000, which block number must be accessed?

A.Block 4 ✅
B.Block 5
C.Block 3
D.Block 6
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The block number is obtained by integer division of the offset by the block size: 5000÷1024=45000 \div 1024 = 4 remainder 904. Zero‑based numbering means the fifth block (index 4) contains the requested byte. If blocks were counted from one, it would be block 5, but the question asks for the block number directly, making block 4 the correct answer. The other choices correspond to off‑by‑one errors.

Q9. A file of 8 KB occupies two data blocks and one index block (4 KB each) using indexed allocation. After the file is deleted, how many bytes of the index block remain unused because only two pointers were needed?

A.0 bytes
B.4088 bytes ✅
C.4096 bytes
D.2048 bytes
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: An index block of 4 KB equals 4096 bytes. Each pointer occupies 4 bytes, so two pointers use 2×4=82 \times 4 = 8 bytes. The unused space is 40968=40884096 - 8 = 4088 bytes. Option B matches this calculation. Option A would be true only if the index block were completely filled, which it is not. Option C assumes the entire block is unused, and option D represents half the block, both incorrect.

Q10. A file initially occupies one 4 KB data block and an index block. When the file size increases to 10 KB, what additional allocation is required?

A.Allocate two more data blocks and update the index block ✅
B.Allocate one more data block and update the index block
C.Allocate a new index block only
D.No additional allocation is needed
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: A 10 KB file needs three 4 KB blocks (12 KB total) to hold its data. The file already has one data block, so two additional data blocks must be allocated. The existing index block can simply store two new pointers, so no new index block is needed. Therefore the correct action is to allocate two more data blocks and update the index block. Allocating only one block would leave the file incomplete, and creating a new index block is unnecessary.

Q11. Assuming each pointer lookup adds a 1 ms overhead, which allocation method provides faster sequential reading for a file consisting of 100 blocks?

A.Indexed allocation ✅
B.Linked allocation
C.Both are equal
D.Neither; overhead is negligible
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: With linked allocation, the system must follow a pointer for each of the 100 blocks, incurring 100×1 ms=100 ms100 \times 1\text{ ms}=100\text{ ms} of extra time. Indexed allocation reads the index block once and then accesses the data blocks sequentially, adding only a single 1 ms lookup. Consequently, indexed allocation yields a faster sequential read. The “both equal” option ignores the per‑block overhead, and “neither” incorrectly assumes the overhead is insignificant.

Q12. Why does indexed allocation simplify file truncation compared to linked allocation?

A.Because it stores file size in the index block
B.Because truncation only requires updating the index block without traversing a chain ✅
C.Because it uses fixed‑size blocks that cannot be partially freed
D.Because it eliminates the need for a free‑space map
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When a file is truncated, indexed allocation permits the system to modify or remove pointers in the index block directly, without walking through a linked list of blocks. This makes truncation a constant‑time operation. Storing the file size does not by itself simplify truncation, fixed‑size blocks still require deallocation, and free‑space maps are used by many schemes, not only linked allocation.

🔗 Related Topics (MCQs)