GATE CS 2023 Set 1 — Question 62
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.NAT+2 / -0MediumPrimary & Secondary IndexesIndexing & File OrganizationDatabases
Databases → Indexing & File Organization → Primary & Secondary Indexes
Last updated
Question
Consider a database of fixed-length records, stored as an ordered file. The database has 25,000 records, with each record being 100 bytes, of which the primary key occupies 15 bytes. The data file is block-aligned in that each data record is fully contained within a block. The database is indexed by a primary index file, which is also stored as a block-aligned ordered file. The figure below depicts this indexing scheme.
Suppose the block size of the file system is 1024 bytes, and a pointer to a block occupies 5 bytes. The system uses binary search on the index file to search for a record with a given key. You may assume that a binary search on an index file of blocks takes block accesses in the worst case.Given a key, the number of block accesses required to identify the block in the data file that may contain a record with the key, in the worst case, is ________.

Correct answer
6 to 6
Solution
To find the number of block accesses required to identify the block in the data file, we follow these steps:
Since the file is block-aligned, records per block.
blocks.
Key size = 15 bytes, Pointer size = 5 bytes.
bytes.
Number of index entries .
blocks.
Since and , .Thus, the number of block accesses required to identify the block in the data file is 6.
1.Calculate records per block in the data file ():
Given block size bytes and record size bytes.Since the file is block-aligned, records per block.
2.Calculate the number of blocks in the data file ():
Total records .blocks.
3.Calculate the size of an index entry ():
A primary index entry consists of the primary key and a block pointer.Key size = 15 bytes, Pointer size = 5 bytes.
bytes.
4.Calculate index entries per block ():
entries per block.5.Calculate the number of blocks in the index file ():
A primary index has one entry for every block in the data file.Number of index entries .
blocks.
6.Calculate worst-case block accesses for binary search on the index file:
As given, accesses = .Since and , .Thus, the number of block accesses required to identify the block in the data file is 6.
Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE CS question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on Indexing & File Organization
2026 Set 2 Q15In the context of DBMS, consider the two sets T and S given below. | T | S | |---|---| | I:…2026 Set 2 Q20Consider concurrent execution of two transactions and in a DBMS, both of which access a…2026 Set 1 Q30Let and be the attributes of a relation in a relational schema. Let…2026 Set 1 Q31In the context of relational database normalization, which of the following statements is/are true?2026 Set 2 Q42In the context of schema normalization in relational DBMS, consider a set F of functional…