GATE / CS ARCHIVE

SUBJECT COLLECTION

Operating Systems · File Systems

16 questions, newest first

GATE CSE has asked 16 questions on File Systems (Operating Systems) from 1993 to 2026, in 15 of the 46 papers; the most recent is in GATE CSE 2026 Set 2. In the last five years it carried 0.8 marks per 100-mark paper on average, against 0.5 since 2003. Since 2014 the questions have been 5 NAT, 1 MSQ and 1 MCQ. 1 group of questions here are solved the same way; “One per method” keeps the newest of each.

Browse topics
2 marks · NAT
Report issue

Storage for free-block number lists

File Systems

Question 53, GATE 2026: A 16 GB disk uses 2 KB blocks. A linked-list bookkeeping scheme stores 32-bit free-block numbers in list blocks, each also reserving one 4-byte next pointer. With K=2¹⁰,G=2³⁰, compute the number of list blocks under the intended capacity-to-record-all-disk-blocks convention; the current free count is not specified.
Tap to enlarge
Answer & solution

Official answer: 16417

Givens and goal

A 16 GB disk uses 2 KB blocks. A linked-list bookkeeping scheme stores 32-bit free-block numbers in list blocks, each also reserving one 4-byte next pointer. With K=2¹⁰,G=2³⁰, compute the number of list blocks under the intended capacity-to-record-all-disk-blocks convention; the current free count is not specified.

Approach

Compute entries per list block and round the required quotient upward.

Step-by-step solution

1. The disk has (16×2³⁰)/(2×2¹⁰)=2²³=8,388,608 blocks. A block number occupies 32/8=4 bytes.
2. Each list block holds 2048 bytes, but 4 are reserved for its successor pointer. The remaining 2044 bytes hold 2044/4=511 block numbers. Counting 512 would forget the link pointer.
3. The capacity calculation is ceil(8,388,608/511). Since 511×16,416=8,388,576, those blocks fall short by 32 entries; one additional block is required. Thus the answer is 16,417.
4. This preserves the official result under the full-disk bookkeeping-capacity convention. If the actual free count is F, the needed entry capacity is ceil(F/511), so an arbitrary partially occupied disk is not determined by the stated disk size alone.
5. If list-storage blocks themselves are excluded from the free-block population on the same disk, a different self-consistent accounting model applies. The official value should therefore not be presented as a universal current free-space measurement. The unspecified free count and accounting convention remain explicit qualifications.

Original paper, page 38 · Answer key

2 marks · NAT
Report issue

Separating linked-allocation overhead from fragmentation

File Systems

Question 51, GATE 2025: A 512 MiB disk uses 64 KiB blocks. Linked allocation reserves four bytes in every allocated block for a next-block pointer, including a four-byte NULL pointer in the last block. A file holds 1 MiB of data. With K=2^10 and M=2^20, how many bytes are unused because of internal fragmentation?
Tap to enlarge
Answer & solution

Official answer: 65468

Approach: Subtract pointer storage from per-block data capacity before computing how many blocks are needed.
A block is 64×1024=65536 bytes. Four bytes are reserved for the pointer, leaving 65532 bytes for file data. The file has 1048576 bytes. Sixteen blocks can hold only 16×65532=1048512 data bytes, which is 64 bytes too little. Therefore a seventeenth block is necessary.
The first sixteen data regions are full and the last contains the remaining 64 file bytes. Its unused data area is 65532−64=65468 bytes. Equivalently, 17×65532−1048576=65468.
The 17 pointer fields occupy 68 bytes, but those bytes are allocated structural overhead rather than unused data space. Counting total physical allocation minus file size would give 17×65536−1048576=65536; subtracting the pointer overhead leaves the required 65468. The last NULL pointer still consumes its specified four bytes.

Original paper, page 51 · Answer key

2 marks · NAT
Report issue

File Systems

Question 63, GATE 2022: A 100-block file exists in contiguous-allocation system A and linked-allocation system B. Insert one memory-resident block between original blocks 50 and 51. There is enough free space after the contiguous file; file-control blocks are in memory. If the respective disk-access counts are nA,nB, find nA+nB.
Tap to enlarge
Answer & solution

Official answer: 153

For contiguous allocation, shift original blocks 51 through 100 one position to the right, working backward. Each of the 50 blocks is read and written, costing 100 disk accesses; writing the new memory-resident block costs one more, so nA=101. For linked allocation, follow the chain by reading blocks 1 through 50, costing 50 reads. Retain block 50 and its old next pointer in memory, write the new block pointing to original block 51, and rewrite block 50 to point to the new block: two writes, so nB=52. The sum is 153. This is the usual uncached data-block I/O model, with file-control blocks already in memory and no extra metadata-flush charges.

The backward shift in A is essential: forward shifting would overwrite block 52 before reading its original contents. In B, the data of blocks 51…100 stay in place; only the predecessor’s link and new block are written. Traversing 50 blocks rather than reading all 100 is sufficient to locate the insertion point.

Original paper, page 40 · Answer key

1 mark · MSQ
Report issue

File Systems

Question 15, GATE 2021: A directory foo is implemented as an unsorted linear list of nodes containing file names and metadata including data-block pointers. Which successful operations necessarily require a full scan? A create a new file; B delete an existing file; C rename an existing file; D open an existing file.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A; C

Our answer: A; C under fresh-name uniqueness checking

Creating a new file requires checking that its proposed name is absent from the entire unsorted directory list. Renaming to a new unused name similarly needs an absence check. Deletion or opening can stop when the existing entry is found, so they do not necessarily scan the entire list. Thus A, C under the intended simple-directory model. A real rename operation that is permitted to replace an existing target, or an indexed name cache, changes the necessity claim; those are outside this linear-list/fresh-name interpretation.

A successful lookup can stop at the matched name, perhaps the first node, so opening/deleting do not necessarily scan all nodes. To establish that a proposed new name is absent, finding no match in only a prefix is insufficient: it could occur in the unvisited suffix. Creation and a rename to a fresh name must therefore inspect the whole directory. The distinction is existential lookup versus proof of absence, not simply whether the operation changes disk contents.

Original paper, page 19 · Answer key

2 marks · NAT
Report issue

Maximum inode-addressed file size

File Systems

Question 42, GATE 2019: An inode has 12 direct pointers, one single-indirect pointer, and one double-indirect pointer. Blocks are 4 kB and each disk-block address is 32 bits. Find the maximum file-data size in GB, rounded to one decimal place; retain the official key's alternative unit ranges.
Tap to enlarge
Answer & solution

Official answer: 3.7 to 3.8 OR 4.0 to 4.1

Our answer: 4.0 under consistent binary units; alternate range retained

1. A block pointer occupies 32/8=4 bytes. Under the usual binary convention, one block is B=4096 bytes, so an indirect block stores 4096/4=1024 addresses.
2. Direct pointers address 12 data blocks. The single-indirect pointer addresses one metadata block containing 1024 data-block pointers, so it contributes 1024 data blocks.
3. The double-indirect pointer reaches a first-level metadata block containing 1024 pointers to second-level indirect blocks. Each second-level block addresses another 1024 data blocks. Its contribution is 1024²=1,048,576 data blocks.
4. Total file-data capacity is (12+1024+1,048,576)×4096=4,299,210,752 bytes. Metadata blocks are not part of the file's data size and must not be added to this total.
5. In binary GiB, divide by 230 to obtain 4.003952... GiB, rounding to 4.0. This is the conventional intended calculation even though the question prints GB.
6. Units matter. Taking kB as 1000 gives (12+1000+1000²)×4000=4,004,048,000 bytes: 4.0 decimal GB, or 3.7 GiB after rounding. Taking binary blocks but decimal GB instead gives 4.3, not an accepted supplied range. Preserve the official disjoint intervals 3.7–3.8 OR 4.0–4.1 rather than concealing this unit ambiguity.

Original paper, page 13 · Answer key

1 mark · MCQ
Report issue

File Systems

Question 8, GATE 2017: Which file-allocation schemes avoid external fragmentation? I:contiguous. II:linked. III:indexed. A:I and III. B:II only. C:III only. D:II and III.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

1. External fragmentation means sufficient total free space may exist but be split into separate regions, so a request needing one contiguous run cannot fit. Contiguous file allocation has this problem.

2. Linked allocation connects a file's blocks by pointers, so successive blocks can occupy arbitrary free block positions. Indexed allocation instead keeps their addresses in an index structure and likewise allows scattered blocks.

3. Both II and III avoid requiring one contiguous extent, giving D. This does not assert that every allocated block is completely used: an incompletely filled last block can still cause internal fragmentation, which is a different phenomenon.

Original paper, page 4 · Answer key

1 mark · NAT
Report issue

File Systems

Question 20, GATE 2014: A FAT-based filesystem has 4-byte FAT entries. The disk size is 100×10^6 bytes and the data-block size is 10^3 bytes. Under the stated FAT-overhead model, find the largest file size in units of 10^6 bytes.
Tap to enlarge
Answer & solution

Official answer: 99.55 to 99.65

Our answer: 99.6

1. Set up the reasoning. First count the nominal blocks on the disk, then reserve one four-byte FAT entry per block. The question's units are decimal, so retain powers of 10 rather than substituting powers of 2.

2. Derive the result. The simplified model gives 100×10⁶/10³=100000 disk blocks and one 4-byte FAT entry per block, totaling 400000 bytes. Subtracting FAT space leaves 99.6×10⁶bytes for one file, within the accepted range. This neglects boot sectors, directories, duplicate FAT copies and other metadata, as no such overhead is specified.

3. Check the interpretation. Subtract the specified overhead from disk capacity before converting to millions of bytes. This simplified maximum assumes one file can occupy all remaining data storage and ignores unmentioned directories, boot structures, and redundant FAT copies.

Original paper, page 33 · Answer key

2 marks · MCQ
Report issue

Maximum file size with double indirection

File Systems

Question 41, GATE 2012: A file system with 300 GByte disk uses a file descriptor with 8 direct block addresses, 1 indirect
        block address and 1 doubly indirect block address. The size of each disk block is 128 Bytes and the
        size of each disk block address is 8 Bytes. The maximum possible file size in this file system is
        (A) 3 KBytes
        (B) 35 KBytes
        (C) 280 KBytes
        (D) dependent on the size of the disk
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Each indirect block holds 128/8=16 addresses. The descriptor therefore reaches 8+16+16²=280 data blocks. Their payload is 280×128=35, 840 bytes=35 KiB (the option calls these KBytes). Indirection blocks are metadata and do not count as file payload. The 300 GByte disk is more than large enough. Hence B.

Check: The eight direct pointers cover 1024 bytes, the single-indirect pointer covers 16×128=2048 bytes, and double indirection covers 256×128=32768 bytes. Their sum is 35840 bytes. Multiplying 280 by KiB instead of by 128 bytes produces the 280-KByte distractor.

Original paper, page 10 · Answer key

1 mark · MCQ
Report issue

Large Unix file block allocation

File Systems

Question 20, GATE 2008: How are blocks of a very large file allocated in the Unix file system?

(A) Contiguous allocation
(B) Linked allocation
(C) Indexed allocation
(D) An extension of indexed allocation
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Unix inodes store direct data-block addresses for small files.
2. For larger files, indirect blocks contain further addresses; double and triple indirection extend this hierarchy.
3. This is multilevel indexed allocation, the extension described in D. It neither requires contiguous blocks nor follows a next-block pointer stored in each data block.

Original paper, page 4

2 marks · MCQ
Report issue

Exact inode addressing capacity

File Systems

Question 49, GATE 2004: A Unix-style inode has 10 direct pointers and one each single-, double- and triple-indirect pointer. Blocks are 1 Kbyte, block addresses are 32 bits, and integers are 48 bits. What is the maximum file size? Use 1 Kbyte=1024 bytes; alternatives are powers of two, not exact inode totals.
Options:
(A) 2^24 bytes
(B) 2^32 bytes
(C) 2^34 bytes
(D) 2^48 bytes
Question 49, GATE 2004: A Unix-style inode has 10 direct pointers and one each single-, double- and triple-indirect pointer. Blocks are 1 Kbyte, block addresses are 32 bits, and integers are 48 bits. What is the maximum file size? Use 1 Kbyte=1024 bytes; alternatives are powers of two, not exact inode totals.
Options:
(A) 2^24 bytes
(B) 2^32 bytes
(C) 2^34 bytes
(D) 2^48 bytes
Tap to enlarge
Your answer
Answer & solution

Answer: 17,247,250,432 bytes; C only as a power-of-two approximation (no official key was published)

1. A1KiB indirect block holds 1024/4=256 addresses. The inode can reference 10+256+256²+256³=16,843,018 data blocks, totaling 17,247,250,432 bytes.

2. The32-bit block-address space and 48-bit integer bound are both larger and do not constrain this total. The dominant triple-indirect contribution alone is 256³×1024=234 bytes, option C, but the exact maximum includes direct, single-indirect and double-indirect blocks and exceeds 234 by 67,381,248 bytes.

3. Thus no offered power-of-two option is exactly the stated maximum; C is the usual scale approximation, not an exact equality.

4. Teaching check: Indirect blocks contain addresses, so divide 1024 bytes by four bytes per address before exponentiating. The triple-indirect branch contributes 256³ data blocks; it does not replace the smaller branches. Distinguish exact capacity from the dominant-power approximation offered by the choices.

Original paper, page 7

1 mark · MCQ
Report issue

File-system block-size tradeoff

File Systems

Question 25, GATE 2003: In the conventional comparison for a fixed-block-size file system, increasing block size leads to: A. Better disk throughput but poorer space utilization; B. Better throughput and better utilization; C. Poorer throughput but better utilization; D. Poorer throughput and poorer utilization.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. Reading a larger contiguous block transfers more useful bytes per seek or setup cost for a sequential workload. But the last block of a file is allocated in full even when only partly used; increasing the allocation unit can increase this internal slack. These effects explain the conventional throughput/utilization tradeoff.

2. Larger blocks amortize per-I/O overhead across more bytes, often improving sequential disk throughput, but waste more unused space in partially occupied final blocks. Thus better throughput with poorer space utilization, A, under the conventional workload comparison. It is not a universal guarantee for every random-access workload.

Original paper, page 3

2 marks · MCQ
Report issue

Capacity under indexed allocation

File Systems

Question 2.22, GATE 2002: In indexed file-block allocation, on what does the maximum possible file size depend?
(A) Block size and block-address size.
(B) Number of index blocks and block size.
(C) Block size, number of index blocks, and block-address size.
(D) None of these.
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Step 1: Track the dimensions of the capacity calculation.

Step 2: Each index block contains floor(B/p) addresses. I such blocks contain I·floor(B/p) addresses in a flat organization, and each address identifies a B-byte data block. Multiplying gives I·floor(B/p)·B bytes. Omitting address size ignores how many pointers fit, while omitting index-block count ignores how many such pointer containers are available.

Conclusion: If I index blocks of B bytes store addresses of p bytes each, a simple flat index addresses I·floor(B/p) data blocks, giving roughly IB²/p file bytes. Thus block size, index-block count and address size all affect capacity, C. Multilevel structures alter the detailed formula, not the need to account for these quantities.

Original paper, page 6

Descriptive
Report issue

Free-list versus bitmap storage

File Systems

Question 25(a), GATE 1998: Disk addresses take d bits; a disk has B blocks, F free. When does a free list occupy less storage than a bitmap?
Question 25(a), GATE 1998: Disk addresses take d bits; a disk has B blocks, F free. When does a free list occupy less storage than a bitmap?
Tap to enlarge
Answer & solution

Answer: Fd<B in the conventional address-list accounting. (no official key was published)

A bitmap uses one bit for every disk block, allocated or free, so its size is B bits. An explicit list storing one d-bit address per free block uses Fd bits. Thus the list is smaller precisely when Fd<B, or F/B<1/d. Equality is a tie, not a reduction. For example d=32 means the list wins below a free-block fraction of 1/32 under this model.

This compares payload metadata. An additional list-head pointer, count or alignment changes the inequality by the corresponding overhead, for example (F+1)d<B if one extra d-bit head is counted only for the list. A linked free list may store next pointers inside otherwise free blocks; in that implementation physical placement and reserved-memory costs differ from an external address array. The simple condition requested assumes the conventional one-address-per-free-block versus one-bit-per-total-block accounting.

Original paper, page 8

Descriptive
Report issue

Directory capacity and file count

File Systems

Question 23(a), GATE 1996: A one-level file system uses 4K-byte disk blocks. Disk block 0 contains a FAT with one 8-bit next-data-block address entry per data block. Disk block 1 is a directory with one 32-bit entry per file. Disk blocks 2,3,... are data blocks 1,2,... . Take K=1024. Find the maximum possible number of files.
Question 23(a), GATE 1996: A one-level file system uses 4K-byte disk blocks. Disk block 0 contains a FAT with one 8-bit next-data-block address entry per data block. Disk block 1 is a directory with one 32-bit entry per file. Disk blocks 2,3,... are data blocks 1,2,... . Take K=1024. Find the maximum possible number of files.
Tap to enlarge
Answer & solution

Answer: 1024 directory entries/files when empty files are permitted; nonempty-file capacity is additionally data-block limited. (no official key was published)

The directory occupies one block, so its storage is 4×1024=4096 bytes. A directory entry uses 32 bits=4 bytes. Hence it contains 4096/4=1024 entries and can name at most 1024 files. This is a directory-capacity bound; the FAT entry count must not be substituted into this division.

Attaining that many named files does not require one data block for every file if zero-length files are allowed. Empty files can occupy directory entries without owning data blocks, so the customary directory-capacity interpretation gives 1024 files. If instead the question requires every file to be nonempty, the result also depends on the number of addressable data blocks and the unspecified pointer conventions. Under a uniform 8-bit data-block address convention with all 256 patterns usable, at most 256 one-block nonempty files fit, and reserved FAT markers reduce that number.

There is a related source-design omission: a 4096-byte FAT can physically hold 4096 one-byte entries, but one-byte next pointers cannot name all 4096 positions under a uniform address scheme. Thus table capacity, pointer addressability, and directory capacity are three distinct quantities. The problem does not specify empty-file policy, reserved values, or actual disk capacity; 1024 is the unambiguous maximum directory entry count, not a proof that 1024 nonempty files can simultaneously occupy the disk.

Original paper, page 10

Descriptive
Report issue

FAT pointer-width file-size bound

File Systems

Question 23(b), GATE 1996: A one-level file system uses 4K-byte disk blocks. Disk block 0 contains a FAT with one 8-bit next-data-block address entry per data block. Disk block 1 is a directory with one 32-bit entry per file. Disk blocks 2,3,... are data blocks 1,2,... . Take K=1024. Find the maximum possible file size in data blocks.
Question 23(b), GATE 1996: A one-level file system uses 4K-byte disk blocks. Disk block 0 contains a FAT with one 8-bit next-data-block address entry per data block. Disk block 1 is a directory with one 32-bit entry per file. Disk blocks 2,3,... are data blocks 1,2,... . Take K=1024. Find the maximum possible file size in data blocks.
Tap to enlarge
Answer & solution

Answer: Conventional answer: 256 data blocks (1 MiB), conditional on uniform 8-bit identifiers without reserved codes; literal exact bound depends on unspecified encoding. (no official key was published)

A FAT-linked file is a chain: its directory entry identifies the first data block, and each block's FAT entry identifies the next. With a uniform 8-bit data-block addressing convention there are 28=256 possible address values. If all values are usable data-block identifiers and termination is represented separately (for example by known file length), a file can traverse at most 256 distinct data blocks. It would occupy 256×4096=1,048,576 bytes. This is the conventional intended pointer-width answer.

The 4KB FAT itself has room for 4096 one-byte entries, but room to store an entry is not the same as enough pointer bits to address its block. Therefore 4096 blocks is not justified merely by dividing FAT size by entry size. A pointer width of at least 12 bits would be required to name 4096 data blocks uniformly.

The literal question does not define end-of-file encoding or whether addresses refer to physical disk blocks or data-block ordinals. Reserving one of the 256 values for EOF leaves at most 255 usable uniform data-block addresses. If physical block numbers 0 and 1 are also excluded as metadata locations, the usable range changes again. These are specification choices, not values established by the paper. Accordingly 256 blocks is conditional on the standard all-patterns-usable data-block model; an exact implementation-level maximum cannot be certified without the address and termination conventions. The directory entry's 32 bits do not by themselves repair the short next pointers.

Original paper, page 10

2 marks · MSQ
Report issue

Locating a filesystem root directory

File Systems

Question 7.8, GATE 1993: Where should the root directory be placed: (A) fixed address in main memory, (B) fixed location on its disk, (C) anywhere on its disk, (D) fixed location on the system disk, or (E) anywhere on the system disk?
Tap to enlarge
Select all that apply
Answer & solution

Answer: B for a fixed-root layout; a discoverable pointer permits arbitrary placement (no official key was published)

The filesystem must be able to locate its root from known metadata. In a simple fixed-root layout this is achieved by placing the root at a predefined disk location, giving B; each disk or filesystem can have its own root, so it need not reside on a separate system disk. Modern designs can instead store a root block or inode pointer in a discoverable superblock, allowing the root itself to be elsewhere. Thus fixed placement is one implementation convention, not a universal requirement. A fixed RAM address does not establish persistent disk organization.

Original paper, page 8