Question
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)
Official answer and solution
- Official answer
- 65468
- From
- Official GATE 2025 answer key
Solution
Compute the usable data capacity per disk block (), find how many blocks the file requires, and compute the unused data bytes in the last block.
- Block size and usable payload per block:
- Block size bytes.
- Each block reserves bytes for the link pointer, so usable data bytes per block bytes.
- Number of blocks required for a file:
- File size bytes.
- The first blocks hold bytes of file data.
- The remaining bytes of the file are stored in the 17th block.
- Internal fragmentation in the 17th (last) block:
- Out of the usable data bytes in the 17th block (since 4 bytes are used by the NULL pointer), only bytes are occupied by the file:
65468
Forgetting to subtract the 4-byte NULL pointer in the 17th block (which would give ).
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2025 Computer Science and Information Technology - Session 1 (CS1)
- Question
- 51 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.