chapter
    Data Structures Practice Questions for GATE DA

    GATE DA Data Structures: 3 chapters, 8 previous year questions (26% of Programming, Data Structures and Algorithms), 452 practice questions and one solved que

    A question from this chapter

    Question 1
    Level 3: Exam Standard

    Assertion (A): The number of distinct valid pop sequences for the input pushed onto a single initially empty stack in that order is 42.

    Reason (R): A valid sequence of 5 pushes and 5 pops corresponds to a Dyck path of length 10. The total number of unrestricted paths is , and the number of invalid paths (which dip below the starting level) is , making the valid count .

    Question 2
    Level 3: Exam Standard

    A hash table of size uses linear probing for collision resolution. The table currently contains exactly 8 active keys and 2 tombstones (deleted markers). The remaining 2 slots are empty.

    To optimize search performance, the tombstones and empty slots are placed to minimize the maximum number of probes required for ANY successful search.

    What is the minimum possible value for this maximum number of probes?

    Question 3
    Level 3: Exam Standard

    The pre-order traversal of a binary tree with distinct integer-valued nodes is

    and its in-order traversal is

    .

    What is the value of the root of the right subtree of the root?

    Free preview ends here

    Login to view the complete practice 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.

    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.

    Data Structures Practice Questions for GATE DA

    GATE DA Data Structures: 3 chapters, 8 previous year questions (26% of Programming, Data Structures and Algorithms), 452 practice questions and one solved question from each chapter.

    About Data Structures Practice Questions

    452 practice questions for Data Structures in GATE DA, sorted chapter by chapter and graded from basic to exam level, each with a full solution.

    Data Structures Weightage in GATE DA

    Data Structures accounts for 8 of 31 Programming, Data Structures and Algorithms previous year questions in our bank (26%), about 2.7 per paper across 3 papers.

    Data Structures Chapter Matrix

    ChapterTopicsPYQsShare of unit PYQsPractice questions
    Stacks, Queues and DequesStack Operations and Simulation, Queue and Deque Operations, ADT Properties: FIFO, LIFO and Lookup338%161
    Hash Tables and Collision ResolutionHash Tables with Open Addressing and Linear Probing, Uniform Hashing and Probe Complexity225%126
    Binary Trees: Properties and TraversalsBinary Tree Traversals and Reconstruction, Binary Tree Structural Properties338%165

    More from Programming, Data Structures and Algorithms

    One Solved Question from Each Data Structures Chapter

    Question 1 · Stacks, Queues and Deques MCQ

    Assertion (A): The number of distinct valid pop sequences for the input pushed onto a single initially empty stack in that order is 42.

    Reason (R): A valid sequence of 5 pushes and 5 pops corresponds to a Dyck path of length 10. The total number of unrestricted paths is , and the number of invalid paths (which dip below the starting level) is , making the valid count .

    1. A.

      Both A and R are true, and R is the correct explanation of A.

    2. B.

      Both A and R are true, but R is NOT the correct explanation of A.

    3. C.

      A is true, but R is false.

    4. D.

      A is false, but R is true.

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: The number of valid stack permutations of elements is given by the -th Catalan number, which is derived using the reflection principle on lattice paths.

    Step 1: Evaluate Assertion (A). The number of valid pop sequences for is the 5th Catalan number, .

    Step 2: Calculate . Thus, A is true.

    Step 3: Evaluate Reason (R). A push is an up-step and a pop is a down-step . A valid sequence never has more pops than pushes at any prefix, corresponding to a Dyck path that never dips below the x-axis.

    Step 4: The total number of paths with 5 up-steps and 5 down-steps is .

    Step 5: By the reflection principle, the number of invalid paths (those that touch ) is equal to the number of paths from to , which requires 4 up-steps and 6 down-steps. This count is .

    Step 6: The number of valid paths is . Thus, R is true.

    Step 7: R provides the exact combinatorial proof (the reflection principle) for why the count in A is 42. Therefore, R is the correct explanation of A.

    Answer: A

    Question 2 · Hash Tables and Collision Resolution MCQ

    A hash table of size uses linear probing for collision resolution. The table currently contains exactly 8 active keys and 2 tombstones (deleted markers). The remaining 2 slots are empty.

    To optimize search performance, the tombstones and empty slots are placed to minimize the maximum number of probes required for ANY successful search.

    What is the minimum possible value for this maximum number of probes?

    1. A.

      3

    2. B.

      4

    3. C.

      5

    4. D.

      8

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a bounding question involving primary clustering and deletion traps. The key insight is that tombstones DO NOT break probe chains; they are treated as occupied during a search. Only empty slots break the table into independent clusters.

    Step 1: Identify the cluster separators.

    There are 2 empty slots. These 2 empty slots divide the table into exactly 3 contiguous clusters of non-empty slots (active keys + tombstones).

    Step 2: Calculate the total number of items in the clusters.

    Total items = 8 active keys + 2 tombstones = 10 items.

    Step 3: Bound the maximum cluster length.

    We need to distribute 10 items into 3 clusters. By the Pigeonhole Principle, at least one cluster must contain items.

    Therefore, the maximum cluster length is at least 4.

    Step 4: Verify if a maximum length of 4 is achievable.

    We can arrange the clusters to have lengths 3, 4, and 3.

    For example:

    • Cluster 1: 2 active, 1 tombstone (length 3)
    • Empty slot
    • Cluster 2: 3 active, 1 tombstone (length 4)
    • Empty slot
    • Cluster 3: 3 active (length 3)

    Total active = 2 + 3 + 3 = 8. Total tombstones = 1 + 1 = 2. Total slots = 3 + 1 + 4 + 1 + 3 = 12.

    The worst-case successful search probes all items in the longest cluster, which takes 4 probes.

    Answer: 4

    Question 3 · Binary Trees: Properties and Traversals MCQ

    The pre-order traversal of a binary tree with distinct integer-valued nodes is

    and its in-order traversal is

    .

    What is the value of the root of the right subtree of the root?

    1. A.

      7

    2. B.

      10

    3. C.

      13

    4. D.

      14

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a tree reconstruction question — the root's position in in-order determines left and right subtree sizes, which lets you split pre-order and read off the right subtree's root.

    Why this method applies: The question gives pre-order and in-order, the classic pair for unique reconstruction. The first element of pre-order is always the root, and its index in in-order gives the exact left subtree size.

    Step 1: Root (first element of pre-order).

    Step 2: Find in the in-order array . It sits at 0-based index . So left subtree size and right subtree size .

    Step 3: Split the remaining pre-order (after the root ) using :

    Left pre-order (next elements).

    Right pre-order (remaining elements).

    Step 4: The root of the right subtree is the first element of the right pre-order .

    Answer: .

    Wrong path (option A): Assuming the tree is balanced and using . Then right pre-order starts at index of the original pre-order: , giving root . This breaks at Step 2 — the left subtree size is determined by the root's position in in-order, not by assuming balance.

    Generalization: Never assume a tree is balanced unless explicitly stated; always use the in-order position of the root to compute subtree sizes.

    Verification: In-order elements before are ( nodes). Elements after are ( nodes). Right pre-order , first element . Consistent.