Programming Data Structures and Algorithms questions — page 2 of 2

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…

Q30

GATE DA 2024 DADivide and ConquerNAT1 mark

Report a problem with Q30

What is wrong?
Consider sorting the following array of integers in ascending order using an in-place Quicksort algorithm that uses the last element as the pivot.
60708090100
The minimum number of swaps performed during this Quicksort is ______.
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…

Q38

GATE DA 2024 DAProgramming in PythonMCQ2 marks−2/3 if wrong

Report a problem with Q38

What is wrong?
Consider the following Python code:
def count(child_dict, i):
    if i not in child_dict.keys():
        return 1
    ans = 1
    for j in child_dict[i]:
        ans += count(child_dict, j)
    return ans

child_dict = dict()
child_dict[0] = [1,2]
child_dict[1] = [3,4,5]
child_dict[2] = [6,7,8]
print(count(child_dict,0))
Which ONE of the following is the output of this code?
Show answer without attempting

Loading the answer…

Q39

GATE DA 2024 DAProgramming in PythonMCQ2 marks−2/3 if wrong

Report a problem with Q39

What is wrong?
Consider the function computeS(X) whose pseudocode is given below:
computeS(X)
S[1] ← 1
for i ← 2 to length(X)
    S[i] ← 1
    if X[i − 1] ≤ X[i]
        S[i] ← S[i] + S[i − 1]
    end if
end for
return S
Which ONE of the following values is returned by the function computeS(X) for X = [6, 3, 5, 4, 10]?
Show answer without attempting

Loading the answer…

Q40

GATE DA 2024 DASearching and SortingMCQ2 marks−2/3 if wrong

Report a problem with Q40

What is wrong?
Let F(n)F(n) denote the maximum number of comparisons made while searching for an entry in a sorted array of size nn using binary search.

Which ONE of the following options is TRUE?
Show answer without attempting

Loading the answer…

Q41

GATE DA 2024 DAProgramming in PythonMCQ2 marks−2/3 if wrong

Report a problem with Q41

What is wrong?
Consider the following Python function:
def fun(D, s1, s2):
    if s1 < s2:
        D[s1], D[s2] = D[s2], D[s1]
        fun(D, s1+1, s2-1)
What does this Python function fun() do? Select the ONE appropriate option below.
Show answer without attempting

Loading the answer…

Q45

GATE DA 2024 DASearching and SortingMCQ2 marks−2/3 if wrong

Report a problem with Q45

What is wrong?
Consider the following sorting algorithms:

(i) Bubble sort
(ii) Insertion sort
(iii) Selection sort

Which ONE among the following choices of sorting algorithms sorts the numbers in the array [4, 3, 2, 1, 5] in increasing order after exactly two passes over the array?
Show answer without attempting

Loading the answer…

Q51

GATE DA 2024 DAGraph Theory and Graph AlgorithmsMSQ2 marks

Report a problem with Q51

What is wrong?
Consider the directed acyclic graph (DAG) below:

Which of the following is/are valid vertex orderings that can be obtained from a topological sort of the DAG?
Question figure
More than one option can be correct.
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/110 correct0 marks

Related topics in GATE DA