File Organization and Indexing · Database Management and Warehousing
3 questions · asked in 2 of 3 years (2024–2026)
MCQ 1 · MSQ 1 · NAT 11-mark 1 · 2-mark 2
2024Questions per year2026
Questions 1–3 of 3
In a relational database, a Tree Index is to be constructed for a relation on a key field. In a Tree, a Node Pointer points to a sub-tree and a Data Record Pointer points to a block of database records.
Let, Node size bytes, Node Pointer size bytes, Search Key Field size bytes and Data Record Pointer size bytes.
The maximum number of Node Pointers that can be present in a non-leaf node of the Tree is ________. (Answer in integer)
Let, Node size bytes, Node Pointer size bytes, Search Key Field size bytes and Data Record Pointer size bytes.
The maximum number of Node Pointers that can be present in a non-leaf node of the Tree is ________. (Answer in integer)
Answer: 195
Take a non-leaf node of a tree that holds node pointers. Along with them it stores key values. The whole node has to fit inside the node size:
The number of pointers must be a whole number, so we take the floor: .
Answer: 195
The number of pointers must be a whole number, so we take the floor: .
Answer: 195
Consider a B+ Tree where the maximum number of key values in each leaf node is and the maximum number of pointers in each non-leaf node is . Let the content of the B+ Tree be as shown in the figure.
Which of the following options denotes the key value(s) stored in the root node after inserting a key value in the given B+ Tree?
Which of the following options denotes the key value(s) stored in the root node after inserting a key value in the given B+ Tree?
Answer: (A)
The root has three children: , and . Here a child holds all keys its separator, up to the next separator. The root and the leaves are both full already. The root can hold at most keys and pointers. Each leaf can hold at most keys.
Now insert . Since , the key goes into leaf . This leaf now becomes , which has keys, so it overflows. The leaf splits into on the left and on the right. The new separator goes up into the root. This is the largest key of the left piece, as per the "" convention.
The root was full, so it overflows too. It now holds with child pointers, but the maximum is pointers. So the root must split as well. For an internal node, the middle key is pushed up (not copied) into a new root above. The middle key is , from . The old root splits into two internal nodes. They hold and .
So the new root has only one key, .
Answer: 5
Now insert . Since , the key goes into leaf . This leaf now becomes , which has keys, so it overflows. The leaf splits into on the left and on the right. The new separator goes up into the root. This is the largest key of the left piece, as per the "" convention.
The root was full, so it overflows too. It now holds with child pointers, but the maximum is pointers. So the root must split as well. For an internal node, the middle key is pushed up (not copied) into a new root above. The middle key is , from . The old root splits into two internal nodes. They hold and .
So the new root has only one key, .
Answer: 5
An OTT company is maintaining a large disk-based relational database of differe nt movies with the following schema:
Consider the following SQL query on the relation database above:
Consider the following SQL query on the relation database above:
SELECT *
FROM Movie, Genre, Movie_Genre
WHERE
Movie.CustomerRating > 3.4 AND
Genre.Name = "Comedy" AND
Movie_Genre.MovieID = Movie.ID AND
Movie_Genre.GenreID = Genre.ID; This SQL query can be sped up using which of the following indexing options? One or more options are correct.
Answer: (A), (B)
The query has these conditions: a range condition, ; an equality condition, ; and two equality joins on the IDs.
A B+ tree supports both equality search and range search. A hash index supports only equality search. It cannot answer a range condition such as , because hashing does not keep the key values in order.
(A) B+ tree on all the attributes: it can serve the range condition and the equality conditions. This speeds up the query.
(B) Hash on Genre.Name serves the equality condition, and B+ trees on the other attributes serve the range condition and the joins. Every condition has an index of a suitable type. This speeds up the query.
(C) A hash index on CustomerRating cannot be used for , so the range condition gets no useful index.
(D) Hash indexes on all the attributes cannot serve the range condition at all.
Answer: (A), (B)
A B+ tree supports both equality search and range search. A hash index supports only equality search. It cannot answer a range condition such as , because hashing does not keep the key values in order.
(A) B+ tree on all the attributes: it can serve the range condition and the equality conditions. This speeds up the query.
(B) Hash on Genre.Name serves the equality condition, and B+ trees on the other attributes serve the range condition and the joins. Every condition has an index of a suitable type. This speeds up the query.
(C) A hash index on CustomerRating cannot be used for , so the range condition gets no useful index.
(D) Hash indexes on all the attributes cannot serve the range condition at all.
Answer: (A), (B)
Keep practising
Topics in Database Management and Warehousing
ER ModelRelational Algebra and Tuple CalculusSQLIntegrity ConstraintsFunctional Dependencies and Normal Forms
File Organization and IndexingYou are here
Data Types and Data TransformationData Warehouse Modelling