CS FundamentalsVery hardGATE CS

A Unix-style inode has 12 direct pointers, one single-indirect and one double-indirect pointer; blocks are 4 KB and block pointers 4 bytes. How many disk blocks in total (data plus index blocks) does a 5 MB file occupy?

  1. A. 1280
  2. B. 1281
  3. C. 1283
  4. D. 1282

Correct answer: C. 1283

5 MB / 4 KB = 1280 data blocks. 12 are direct, the single-indirect block covers 1024 more (1036 so far), and the last 244 need the double-indirect block plus one second-level block. Index blocks = 1 + 2 = 3, so 1283 in all.

More Operating Systems questions

Exams that ask this topic