chapter

    File Systems and Storage Allocation Pyqs for Gate Cs

    Solve 4+ File Systems and Storage Allocation previous year questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    2026 Slot Set2 PYQ
    Level 3: Exam Standard
    To keep track of free blocks in a file system, one of the two approaches is generally used – using bitmaps (bit vectors) or using linked lists. Consider that the linked list approach is used to keep track of free blocks in a file system. Assume that the disk size is 16 GB, block size is 2 KB, and block numbers used are 32-bit long. A single pointer of size 4 bytes is used in each block of the list to point to the next block of the list. The number of blocks required to hold the free disk block numbers is ____________. (answer in integer)

    Note: and
    Question 2
    2025 Slot Set1 PYQ
    Level 3: Exam Standard

    A disk of size 512M bytes is divided into blocks of 64K bytes. A file is stored in the disk using linked allocation. In linked allocation, each data block reserves 4 bytes to store the pointer to the next data block. The link part of the last data block contains a NULL pointer (also of 4 bytes). Suppose a file of 1M bytes needs to be stored in the disk. Assume, and . The amount of space in bytes that will be wasted due to internal fragmentation is ______. (Answer in integer)

    Question 3
    2022 PYQ
    Level 3: Exam Standard

    Consider two files systems and , that use contiguous allocation and linked allocation, respectively. A file of size 100 blocks is already stored in and also in . Now, consider inserting a new block in the middle of the file (between and block), whose data is already available in the memory. Assume that there are enough free blocks at the end of the file and that the file control blocks are already in memory. Let the number of disk accesses required to insert a block in the middle of the file in and are and , respectively, then the value of is_________.

    Question 4
    2021 Slot Set1 PYQ
    Level 3: Exam Standard
    Consider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory foo.
    Which of the following operations will necessarily require a full scan of foo for successful completion?
    Free preview ends here

    Login to view the complete previous-year questions and solutions

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Explore complete test series, official past papers, and chapter-wise study tools.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    File Systems and Storage Allocation PYQs for GATE CS

    Solve 4+ File Systems and Storage Allocation previous year questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Chapter Roadmap: File Systems and Storage Allocation

    Chapter Journey

    File Systems & Storage Allocation

    1. Contiguous & Linked Allocation

    Mapping logical files to physical disk blocks. Trade-offs between linear and chained storage.

    2. Directory Search & Operations

    Locating files, managing metadata, and analyzing search efficiencies.

    3. Free-Space Management

    Tracking available disk blocks using bitmaps and linked lists.

    Why start here? Understanding how individual files are stored is the foundational step before analyzing directories and free space.

    Hero Concept: The File Allocation Problem

    The File Allocation Problem

    How do we map the logical blocks of a file to the physical blocks on a disk?

    Efficient Access
    Minimize disk head movement
    Space Efficiency
    Minimize fragmentation
    Dynamic Growth
    Expand without moving data

    Foundational Strategies

    Contiguous Allocation

    Blocks are stored in adjacent physical sectors.

    Linked Allocation

    Blocks are scattered, but chained together via pointers.

    File Systems and Storage Allocation: Solved Questions with Step-by-Step Explanations (4 Problems)

    Question 1 · Operating System · 2026_Set2 NAT
    To keep track of free blocks in a file system, one of the two approaches is generally used – using bitmaps (bit vectors) or using linked lists. Consider that the linked list approach is used to keep track of free blocks in a file system. Assume that the disk size is 16 GB, block size is 2 KB, and block numbers used are 32-bit long. A single pointer of size 4 bytes is used in each block of the list to point to the next block of the list. The number of blocks required to hold the free disk block numbers is ____________. (answer in integer)

    Note: and
    Correct Answer:

    16417

    Step-by-Step Solution

    Insight: This is a free-space linked list overhead question. The key is to compute how many free block pointers fit in one physical block (minus the next-pointer), then divide total free blocks by that capacity.

    Exam route:

    1. Total blocks = .
    2. Pointers per block = .
    3. Usable addresses per block = (subtract the next-pointer).
    4. Blocks needed = .

    Learning route:

    The linked list approach stores free block numbers in a chain of blocks. Each block in the list can hold multiple pointers. However, one pointer in each block must point to the next block in the list. So if a block can physically hold pointers, only are available for free block numbers.

    First, compute total disk blocks: bytes. Block size = bytes. Total = blocks.

    Next, pointers per block: pointers. Usable = .

    Finally, blocks needed for the free list: . Compute , so we round up to $16417$.

    Common trap: Using bytes instead of , or forgetting to subtract the next-pointer from the block capacity.

    Verification: ✓. ✓. So $16417$ is correct.

    Question 2 · Operating System · 2025_Set1 NAT

    A disk of size 512M bytes is divided into blocks of 64K bytes. A file is stored in the disk using linked allocation. In linked allocation, each data block reserves 4 bytes to store the pointer to the next data block. The link part of the last data block contains a NULL pointer (also of 4 bytes). Suppose a file of 1M bytes needs to be stored in the disk. Assume, and . The amount of space in bytes that will be wasted due to internal fragmentation is ______. (Answer in integer)

    Correct Answer:

    65536

    Step-by-Step Solution

    Insight: This is an internal fragmentation question for linked allocation. The key is to compute usable data per block, find how many blocks the file needs, then subtract the actual file size from the total allocated space.

    Exam route:

    1. Usable data per block = bytes.
    2. Blocks needed = .
    3. Total allocated = bytes.
    4. Wasted = bytes.

    Learning route:

    In linked allocation, every block reserves space for a pointer. This pointer overhead plus any unused data space in the last block constitutes internal fragmentation. The file of bytes must be split across blocks that each hold only $65532$ bytes of actual data. Dividing gives $16.00097$, so we need $17$ blocks. The first $16$ blocks are fully used for data ( bytes), leaving $64$ bytes for the $17$th block. That $17$th block still consumes a full $65536$ bytes on disk. Total wasted = bytes. Equivalently, total allocated minus file size = .

    Common trap: Forgetting that the last block's pointer also counts as wasted space, or using decimal prefixes () instead of binary.

    Verification: $16$ full blocks hold $1048512$ bytes. Block $17$ holds $64$ bytes of data + $4$ bytes pointer + $65468$ bytes empty = $65536$ bytes. Total data = ✓. Total wasted = ✓.

    Question 3 · Operating System · 2022 NAT

    Consider two files systems and , that use contiguous allocation and linked allocation, respectively. A file of size 100 blocks is already stored in and also in . Now, consider inserting a new block in the middle of the file (between and block), whose data is already available in the memory. Assume that there are enough free blocks at the end of the file and that the file control blocks are already in memory. Let the number of disk accesses required to insert a block in the middle of the file in and are and , respectively, then the value of is_________.

    Correct Answer:

    154

    Step-by-Step Solution

    Insight: This is a disk access counting question for file insertion. The key is to apply the correct formula for contiguous (shift right) and linked (traverse and update pointer) allocation separately, then sum.

    Exam route:

    1. Contiguous (): Insert between block 50 and 51 in a 100-block file. Shift blocks 51–100 right: 50 reads + 50 writes. Write new block: 1 write. Total .
    2. Linked (): Traverse to block 50: 50 reads. Read block 51 to get its pointer: 1 read. Write new block: 1 write. Update block 50's pointer: 1 write. Total .
    3. .

    Learning route:

    For contiguous allocation, inserting at position in an -block file requires shifting blocks through one position to the right. Each shifted block must be read from its old position and written to its new position, then the new block is written into the freed slot. Here , , so we shift blocks. That gives $50$ reads and $50$ writes for the shift, plus $1$ write for the new block, totaling $101$ accesses.

    For linked allocation, we traverse the chain from the start to the -th block ( reads), read the -th block to capture its forward pointer ($1$ read), write the new block with that pointer ($1$ write), and update the -th block's pointer to the new block ($1$ write). Here , giving accesses.

    Common trap: Forgetting that in linked allocation, the new block's write and the pointer update are two separate writes, or miscounting the traversal reads.

    Verification: Contiguous formula ✓. Linked formula ✓. Sum = $154$ ✓.

    Question 4 · Operating System · 2021_Set1 MSQ
    Consider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory foo.
    Which of the following operations will necessarily require a full scan of foo for successful completion?
    1. A.

      Creation of a new file in foo

    2. B.

      Deletion of an existing file from foo

    3. C.

      Renaming of an existing file in foo

    4. D.

      Opening of an existing file in foo

    Correct Answer:

    ["A","C"]

    Step-by-Step Solution

    Insight: This is a directory operation question testing the distinction between presence checks (can stop early) and absence checks (must scan all). The key word is "necessarily" — it asks which operations cannot exit early under any circumstances.

    Exam route:

    1. Creation of new file: Must ensure the name is unique (absence check) → necessarily requires full scan.
    2. Deletion of existing file: Only needs to find the file (presence check) → can stop early.
    3. Renaming of existing file: Must find the old name (presence) AND ensure the new name is unique (absence) → necessarily requires full scan.
    4. Opening of existing file: Only needs to find the file (presence check) → can stop early.

    Answer: A and C.

    Learning route:

    In a linear list directory, operations are classified by whether they require a presence check or an absence check.

    A presence check looks for a specific file. If found, the operation can terminate immediately. Delete and open only need to find the file, so they can stop early.

    An absence check must prove a file name does not exist. This requires scanning every entry to ensure no duplicate exists. Create must verify the new name is unique, so it necessarily requires a full scan. Rename must find the old name (can stop early) but also verify the new name is unique (must scan all), so it necessarily requires a full scan.

    Common trap: Confusing worst-case time complexity with "necessarily" requiring a full scan. Delete takes in the worst case, but it does not necessarily require a full scan because it can exit early if the file is found at the beginning.

    Verification: Create → absence check → full scan ✓. Delete → presence check → can stop ✓. Rename → absence check for new name → full scan ✓. Open → presence check → can stop ✓.

    More previous year questions (pyqs) in this unit