File System · Databases
24 questions · asked in 16 of 27 years (2000–2026)
MCQ 17 · MSQ 2 · NAT 51-mark 18 · 2-mark 6
2000Questions per year2026
Questions 1–5 of 24
In the context of DBMS, consider the two sets and given below.
Which one of the following is the correct match from to ?
Which one of the following is the correct match from to ?
Answer: (C)
Match each schema level of the three-tier DBMS architecture with what it describes:
- Logical schema (I): gives the overall logical structure of the database for all users. This is what relations (N) show.
- Physical schema (II): tells how data is really stored at the lowest level. This is file organization and indexes (M).
- External schema (III): gives each user their own view of part of the data. This is what views (L) do.
Answer: I-N, II-M, III-L
- Logical schema (I): gives the overall logical structure of the database for all users. This is what relations (N) show.
- Physical schema (II): tells how data is really stored at the lowest level. This is file organization and indexes (M).
- External schema (III): gives each user their own view of part of the data. This is what views (L) do.
Answer: I-N, II-M, III-L
An index in a DBMS is said to be dense if an index entry appears for every search-key value in the indexed file. Otherwise it is called a sparse index. Consider the following two statements.
: A hash index must be a dense index
: A tree index can be a sparse index
Which one of the following options is correct?
: A hash index must be a dense index
: A tree index can be a sparse index
Which one of the following options is correct?
Answer: (A)
S1 (a hash index must be dense): A hash index finds the bucket straight from the key with a hash function. There is no sorted order, so entries cannot be skipped as in a sparse index. So a hash index needs its own entry, pointing to the data, for every distinct search-key value. True.
S2 (a -tree can be sparse): Take a -tree index built on a search key that also fixes the sorted order of the data file (a primary/clustering index). Then one index entry per data block is enough, pointing to the first record of that block. It does not need one entry per record, because the other records in the block can be reached by scanning in order from there. So a sparse -tree index is fully possible. True.
Answer: Both S1 and S2 are true.
S2 (a -tree can be sparse): Take a -tree index built on a search key that also fixes the sorted order of the data file (a primary/clustering index). Then one index entry per data block is enough, pointing to the first record of that block. It does not need one entry per record, because the other records in the block can be reached by scanning in order from there. So a sparse -tree index is fully possible. True.
Answer: Both S1 and S2 are true.
Which of the following file organizations is/are I/O efficient for the scan operation in DBMS?
One or more options are correct.
Answer: (A), (B)
A scan reads every record of the file.
- Heap and sorted files keep records packed in pages that sit next to each other. So each page is read only once, and these files are I/O efficient for a scan.
- Unclustered tree / hash index: following the index, the records lie in random pages. The same page may be read many times, about one I/O for each record. So these are not efficient for a scan.
Answer: (A), (B)
- Heap and sorted files keep records packed in pages that sit next to each other. So each page is read only once, and these files are I/O efficient for a scan.
- Unclustered tree / hash index: following the index, the records lie in random pages. The same page may be read many times, about one I/O for each record. So these are not efficient for a scan.
Answer: (A), (B)
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 _____
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 _____
Answer: 6
Find the index size in steps:
- Records in one data block = So the number of data blocks = 25000 / 10 = 2500.
- The primary (sparse) index keeps one entry for each data block. That gives 2500 entries, and each entry is bytes.
- Entries in one index block = So the number of index blocks = .
Now do binary search on the index: block accesses are needed to find the data block.
Answer: 6
- Records in one data block = So the number of data blocks = 25000 / 10 = 2500.
- The primary (sparse) index keeps one entry for each data block. That gives 2500 entries, and each entry is bytes.
- Entries in one index block = So the number of index blocks = .
Now do binary search on the index: block accesses are needed to find the data block.
Answer: 6
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?
Which of the following operations will necessarily require a full scan of foo for successful completion?
One or more options are correct.
Answer: (A), (C)
Let us look at each operation:
- Create: we must make sure no file with the same name is already there so the whole list is scanned.
- Rename: we must make sure the new name is not already in use so the whole list is scanned.
- Delete or open an existing file: the search ends once the file is found so a full scan is not always needed.
Answer: Creation of a new file, Renaming of an existing file
- Create: we must make sure no file with the same name is already there so the whole list is scanned.
- Rename: we must make sure the new name is not already in use so the whole list is scanned.
- Delete or open an existing file: the search ends once the file is found so a full scan is not always needed.
Answer: Creation of a new file, Renaming of an existing file
Keep practising