chapter

    Indexing and B+ Trees Pyqs for Gate Da

    Solve 3+ Indexing and B+ Trees previous year questions for GATE DA with answers and detailed solutions. Free sample questions below.

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    2026 PYQ
    Level 3: Exam Standard
    In a relational database, a B+ Tree Index is to be constructed for a relation on a key field. In a B+ Tree, a Node Pointer points to a sub-tree and a Data Record Pointer points to a block of database records.

    Let, Node size = 4096 bytes, Node Pointer size = 10 bytes, Search Key Field size = 11 bytes and Data Record Pointer size = 12 bytes.

    The maximum number of Node Pointers that can be present in a non-leaf node of the B+ Tree is ________ . (Answer in integer)
    Question 2
    2026 PYQ
    Level 3: Exam Standard
    Consider a B+ Tree where the maximum number of key values in each leaf node is 2 and the maximum number of pointers in each non-leaf node is 3. Let the content of the B+ Tree be as shown in the figure.

    5 8 1 5 7 8 9 12 NULL

    Which of the following options denotes the key value(s) stored in the root node after inserting a key value 3 in the given B+ Tree?
    Question 3
    2024 PYQ
    Level 3: Exam Standard
    An OTT company is maintaining a large disk-based relational database of different
    movies with the following schema:

    Movie(ID, CustomerRating)
    Genre(ID, Name)
    Movie_Genre(MovieID, GenreID)

    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?
    Free preview ends here

    Login to view the complete previous-year questions and solutions

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Explore complete test series, official past papers, and chapter-wise study tools.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Indexing and B+ Trees PYQs for GATE DA

    Solve 3+ Indexing and B+ Trees previous year questions for GATE DA with answers and detailed solutions. Free sample questions below.

    Chapter Roadmap: Indexing and B+ Trees

    Chapter Journey

    1. B+ Tree Structure, Insertion and Fanout Calculation
    Current Topic • High Importance • Foundation for all indexing and disk I/O questions
    2. Index Selection for SQL Query Processing
    Upcoming • Moderate Importance • Applies B+ tree mechanics to query execution plans
    What you will master: Deriving node capacity limits from block sizes, executing step-by-step B+ tree insertions, and avoiding classic split traps.

    Why B+ Trees? The Core Intuition

    The Disk I/O Problem

    Database systems minimize slow disk accesses by reading data in fixed-size blocks (or pages). A good index must minimize the number of blocks read to find a record.

    Why Not Binary Search Trees?

    A binary tree has a maximum of two children per node. For a million records, the height is around 20, meaning up to 20 disk reads. This is inefficient.

    The B+ Tree Solution

    1. High Fanout: Each node can hold hundreds of keys, drastically reducing the tree height (typically to 3 or 4 levels for millions of records).
    2. Balanced: All leaf nodes are at the exact same depth, guaranteeing predictable, worst-case search time.
    3. Data at Leaves Only: Internal nodes act purely as a "map" or routing guide. Only leaf nodes contain Data Record Pointers.
    4. Linked Leaves: Leaf nodes are connected via sequential pointers, making range queries highly efficient without traversing back up the tree.

    Indexing and B+ Trees: Solved Questions with Step-by-Step Explanations (3 Problems)

    Question 1 · Database Management and Warehousing · 2026 NAT
    In a relational database, a B+ Tree Index is to be constructed for a relation on a key field. In a B+ Tree, a Node Pointer points to a sub-tree and a Data Record Pointer points to a block of database records.

    Let, Node size = 4096 bytes, Node Pointer size = 10 bytes, Search Key Field size = 11 bytes and Data Record Pointer size = 12 bytes.

    The maximum number of Node Pointers that can be present in a non-leaf node of the B+ Tree is ________ . (Answer in integer)
    Correct Answer:

    195

    Step-by-Step Solution

    Insight: The maximum fanout of a non-leaf node is constrained by the fixed block size, ensuring all pointers and keys fit within a single node.

    Exam route: Use the non-leaf fanout inequality: . Substitute , , , and solve for integer .

    Learning route:

    1. Identify node components: A non-leaf node contains node pointers and search keys. Data record pointers are only present in leaf nodes.
    2. Set up the size inequality: Total size = .
    3. Substitute given values: .
    4. Simplify the inequality: .
    5. Solve for : .
    6. Apply integer constraint: The maximum number of pointers must be an integer, so we take the floor, yielding .
    Question 2 · Database Management and Warehousing · 2026 MCQ
    Consider a B+ Tree where the maximum number of key values in each leaf node is 2 and the maximum number of pointers in each non-leaf node is 3. Let the content of the B+ Tree be as shown in the figure.

    5 8 1 5 7 8 9 12 NULL

    Which of the following options denotes the key value(s) stored in the root node after inserting a key value 3 in the given B+ Tree?
    1. A.

      5

    2. B.

      8

    3. C.

      3 and 5

    4. D.

      3, 5 and 8

    Correct Answer:

    A

    Step-by-Step Solution

    Insight: Leaf overflow triggers a split, promoting a separator to the parent. If the parent exceeds its pointer capacity, it recursively splits, pushing the middle key up to a new root.

    Exam route: Insert 3 into [1, 5] [1, 3, 5]. Split leaf: left gets [1, 3], right gets [5]. Promote separator to parent. Root [5, 8] becomes [3, 5, 8] (4 pointers), which overflows (max 3 pointers). Split root: middle key 5 moves to new root.

    Learning route:

    1. Locate insertion point: Key 3 is , so it goes down the first pointer into the leaf [1, 5].
    2. Leaf overflow: The leaf becomes [1, 3, 5], exceeding the max capacity of 2 keys.
    3. Leaf split: Distribute entries evenly. Left leaf gets keys: [1, 3]. Right leaf gets the remaining 1 key: [5]. The separator key is promoted to the parent.
    4. Parent overflow: The root originally had keys [5, 8] and 3 pointers. Adding a new pointer and key makes it 4 pointers and 3 keys (e.g., [3, 5, 8]), exceeding the max pointer limit of 3.
    5. Root split: The root splits into two nodes. The middle key (5) is pushed up alone to form a new root. The left child keeps [3] and the right child keeps [8].
    6. Final state: The new root contains only the single key 5.
    Question 3 · Database Management and Warehousing · 2024 MSQ
    An OTT company is maintaining a large disk-based relational database of different
    movies with the following schema:

    Movie(ID, CustomerRating)
    Genre(ID, Name)
    Movie_Genre(MovieID, GenreID)

    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?
    1. A.

      tree on all the attributes.

    2. B.

      Hash index on Genre.Name and tree on the remaining attributes.

    3. C.

      Hash index on Movie.CustomerRating and tree on the remaining attributes.

    4. D.

      Hash index on all the attributes.

    Correct Answer:

    ["A","B"]

    Step-by-Step Solution

    Insight: Range queries strictly require B+ trees for efficient traversal, while equality queries can be optimized by either B+ trees or hash indexes.

    Exam route: Identify condition types. Genre.Name = 'Comedy' is equality (Hash or B+). Movie.CustomerRating > 3.4 is range (B+ only). Eliminate any option placing a Hash index on CustomerRating.

    Learning route:

    1. Analyze query conditions: Genre.Name = 'Comedy' (Equality), Movie.CustomerRating > 3.4 (Range), and two join conditions (Equality).
    2. Evaluate index capabilities: Hash indexes provide lookup for exact matches but cannot process range queries (, , BETWEEN). B+ trees support both equality and range queries efficiently via sequential leaf traversal.
    3. Check Option A: A B+ tree on all attributes supports all conditions (both range and equality). This is valid.
    4. Check Option B: A Hash index on Genre.Name perfectly optimizes the equality lookup. A B+ tree on the remaining attributes handles the range query on CustomerRating and the equality joins. This is valid.
    5. Check Option C & D: Both place a Hash index on Movie.CustomerRating. Since Hash indexes cannot evaluate the > 3.4 range condition, the optimizer would be forced into an inefficient full scan for this predicate, failing to speed up the query. These are invalid.

    More previous year questions (pyqs) in this unit