Topics in Data Structures

Filter by year

Data Structures questions

Q25

GATE DA 2026 DAData StructuresMSQ1 mark

Report a problem with Q25

What is wrong?
You are given the following Pre-order and In-order traversals of a Binary Tree T with nodes E, F, G, P, Q, R, S.
Pre-order: P Q S E R F G
In-order: S Q E P F R G
Which of the following statements is/are true about the Binary Tree T?
More than one option can be correct.
Show answer without attempting

Loading the answer…

Q39

GATE DA 2026 DAData StructuresMCQ2 marks−2/3 if wrong

Report a problem with Q39

What is wrong?
A recursive function in Python is given.
def mystery(n):
    if n <= 0:
        return 1
    else:
        return mystery(n-1) + mystery(n-2)
Now, consider the following function call:
mystery(4)
Assume that a typical runtime stack is used to manage function calls. Each function call is pushed onto the stack and removed only after it finishes execution.
Which of the following options denotes the total number of function calls (i.e., the total number of stack activations), including the initial call, to compute mystery(4)?
Show answer without attempting

Loading the answer…

Q18

GATE DA 2025 DAData StructuresMCQ1 mark−1/3 if wrong

Report a problem with Q18

What is wrong?
Consider a hash table of size 10 with indices {0,1,…,9}\{0, 1, \ldots, 9\}, with the hash function
h(x)=3x(mod10),h(x) = 3x \pmod{10},
where linear probing is used to handle collisions. The hash table is initially empty and then the following sequence of keys is inserted into the hash table: 1, 4, 5, 6, 14, 15. The indices where the keys 14 and 15 are stored are, respectively
Show answer without attempting

Loading the answer…

Q64

GATE DA 2025 DAData StructuresNAT2 marks

Report a problem with Q64

What is wrong?
Consider the following pseudocode.
Create empty stack S
Set x=0, flag=0, sum=0
Push x onto S
while (S is not empty){
    if (flag equals 0){
        Set x = x+1
        Push x onto S}
    if (x equals 8):
        Set flag=1
    if (flag equals 1){
        x = Pop(S)
        if (x is odd):
            Pop(S)
        Set sum = sum + x}
}
Output sum
The value of sum output by a program executing the above pseudocode is __________ (Answer in integer)
Show answer without attempting

Loading the answer…

Q16

GATE DA 2024 DAData StructuresMCQ1 mark−1/3 if wrong

Report a problem with Q16

What is wrong?
Match the items in Column 1 with the items in Column 2 in the following table:
Column 1Column 2
(p) First In First Out(i) Stacks
(q) Lookup Operation(ii) Queues
(r) Last In First Out(iii) Hash Tables
Show answer without attempting

Loading the answer…

Q21

GATE DA 2024 DAData StructuresMCQ1 mark−1/3 if wrong

Report a problem with Q21

What is wrong?
Consider performing uniform hashing on an open address hash table with load factor α=nm<1\alpha = \frac{n}{m} < 1, where nn elements are stored in the table with mm slots. The expected number of probes in an unsuccessful search is at most 11−α\frac{1}{1 - \alpha}.

Inserting an element in this hash table requires at most ______ probes, on average.
Show answer without attempting

Loading the answer…

Q28

GATE DA 2024 DAData StructuresMSQ1 mark

Report a problem with Q28

What is wrong?
Consider the following tree traversals on a full binary tree:

(i) Preorder
(ii) Inorder
(iii) Postorder

Which of the following traversal options is/are sufficient to uniquely reconstruct the full binary tree?
More than one option can be correct.
Show answer without attempting

Loading the answer…

Q32

GATE DA 2024 DAData StructuresNAT1 mark

Report a problem with Q32

What is wrong?
The fundamental operations in a double-ended queue D are:

insertFirst(e) – Insert a new element e at the beginning of D.
insertLast(e) – Insert a new element e at the end of D.
removeFirst() – Remove and return the first element of D.
removeLast() – Remove and return the last element of D.

In an empty double-ended queue, the following operations are performed:
insertFirst(10)
insertLast(32)
a ← removeFirst()
insertLast(28)
insertLast(17)
a ← removeFirst()
a ← removeLast()
The value of a is ______.
Show answer without attempting

Loading the answer…

Q52

GATE DA 2024 DAData StructuresMSQ2 marks

Report a problem with Q52

What is wrong?
Let H,I,L,H, I, L, and NN represent height, number of internal nodes, number of leaf nodes, and the total number of nodes respectively in a rooted binary tree.

Which of the following statements is/are always TRUE?
More than one option can be correct.
Show answer without attempting

Loading the answer…

0/90 correct0 marks

Related topics in Programming Data Structures and Algorithms