• retagged by
20,743 views
48 48 votes

In the index allocation scheme of blocks to a file, the maximum possible size of the file depends on

  1. the size of the blocks, and the size of the address of the blocks.
  2. the number of blocks used for the index, and the size of the blocks.
  3. the size of the blocks, the number of blocks used for the index, and the size of the address of the blocks.
  4. None of the above

9 Answers

Best answer
72 72 votes

In Index allocation size of maximum file can be derived like following:

No of addressable blocks using one Index block $(A)=$ Size of block / Size of block address

No of block addresses available for addressing one file $(B)=$

No of Maximum blocks we can use for the Index *  No of addressable blocks using one Index block $(A)$

Size of File = $B$ * Size of Block

So, it is clear that:

Answer is (C).

A & B are incomplete.

• edited by
15 15 votes

As the size of the block increases, file size increases (Keeping number of blocks constant).

As the number of blocks for index increases, number of index entries increases (keeping size of block contstant) and so file size increases (we cannot have an index record without it's corresponding file record so as i keep on increasing index records even file records increases)

As the block address size increases,  number of index entries decreases (keeping block size and number of blocks constant) and so file number of file records decreases and so file size decreases.

So option C) 

5 5 votes

someone please verify.  answer answer is C. 

First some background on indexing.

File is stored in form of blocks in hard disk. File is made up of records, each record has some key field on which indexes are created(for faster access of file). suppose record is of 64 byte and key field is of 14 byte. hence we create index  on this 14 byte key field(not necessary as you can index on non key field also). Apart from 14 bytes of key field it must also include block address in which record with this key value is present . lets say block address is 2 byte.

Now come to question

size of the index file directly proportional to number of blocks used for the index. 

if we have 1000 records. there will be 1000(14+2) Bytes for index. If we store all of them in single block(provided it fits in single block) there will not be multilevel indexing, hence no memory needed to store secondary indexes.

I still have doubt in this .

size of block  

If size of block is large we can accommodate  more indexes per block hence number of levels in indexing is less hence file size is lesser.

siz of address of block 

If block size becomes 1 byte instead of 2 byte , we need less number of block hence file size is less

please correct me if my answer is wrong.

2 2 votes
✅ Correct Answer: C

> The size of the blocks, the number of blocks used for the index, and the size of the address of the blocks.

In index-based allocation (like in UNIX-style inode systems), the maximum file size is determined by:

Block size:
Each data block holds a fixed amount of file content (e.g. 4 KB, 8 KB). Larger blocks = larger possible file size.

Size of address (pointer size):
Affects how many pointers can fit in an index block. For example, 4-byte addresses in a 4 KB block allow 1024 pointers.

Number of index blocks:
These are actual disk blocks used to store pointers to data blocks.
They include blocks used in single, double, and triple indirect addressing.


> ✅ Note: The direct pointers in the inode are part of the inode structure, not blocks, so they are not included when we say "number of blocks used for indexing."
• edited by
1 1 vote

The question simply means "The size of the file(data+ index)depends upon which factor"

1) Size of the Block= True if the block size is more, it can accommodate more no of row or tuples or data, and indexing could be done of 1st row in a block(SPARSE INDEXING). Hence index size will be decreased.

2) No. of block used for Indexing = Although it looks true but it is false because we can not decide, how many blocks needed to store database in memory. It will store the complete database in memory and moreover we can not decide on which block there should be indexing is done & which block not to be. So "no of Block" is fine but "no of blocks used for indexing " is the wrong statement.

3) Size of the address of block= True, because record pointer in index file stores key and corresponding address of block where it is stored.

So in my opinion the answer should be A

• edited by
1 flag:
✌ Edit necessary (harshitraj12)
1 1 vote
The word 'file', if it is 'the record' i.e. 'Database file' then ans is 'd'

The word 'file' means 'index file' the answer is 'c'

I don't know why they are so lazy to add one word to remove confusion, could have asked about 'index file' than 'file' anyone may confuse it to the main file/record
Answer:
Position:
Show:

Related questions

36 36 votes
1 answers 1 answer
7.4k
7.4k views
Kathleen asked Sep 15, 2014
7,358 views
Construct all the parse trees corresponding to $i + j * k$ for the grammar $E \rightarrow E+E$ $E \rightarrow E*E$ $E \rightarrow id$In this grammar, what is the pr...
67 67 votes
7 answers 7 answers
24.7k
24.7k views
Kathleen asked Sep 15, 2014
24,671 views
Which combination of the following features will suffice to characterize an OS as a multi-programmed OS?More than one program may be loaded into main memory at the same t...
41 41 votes
6 answers 6 answers
25.7k
25.7k views
Kathleen asked Sep 15, 2014
25,660 views
Which of the following scheduling algorithms is non-preemptive?Round RobinFirst-In First-OutMultilevel Queue SchedulingMultilevel Queue Scheduling with Feedback
13 13 votes
4 4 answers
6.8k
6.8k views
go_editor asked Feb 28, 2018
6,760 views
The functionality of atomic TEST-AND-SET assembly language instruction is given by the following C functionint TEST-AND-SET (int *x) { int y; A1: y=*x; A2: *x=1; A3: retu...