Programming Data Structures and Algorithms questions

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…

Q23

GATE DA 2025 DAProgramming in PythonMCQ1 mark−1/3 if wrong

Report a problem with Q23

What is wrong?
Consider the following Python declarations of two lists.
A=[1,2,3]
B=[4,5,6]
Which one of the following statements results in A= [1, 2, 3, 4, 5, 6]?
Show answer without attempting

Loading the answer…

Q27

GATE DA 2025 DASearching and SortingMSQ1 mark

Report a problem with Q27

What is wrong?
For which of the following inputs does binary search take time O(log⁡n)O(\log n) in the worst case?
More than one option can be correct.
Show answer without attempting

Loading the answer…

Q29

GATE DA 2025 DASearching and SortingMSQ1 mark

Report a problem with Q29

What is wrong?
Suppose that insertion sort is applied to the array [1,3,5,7,9,11,x,15,13][1, 3, 5, 7, 9, 11, x, 15, 13] and it takes exactly two swaps to sort the array. Select all possible values of xx.
More than one option can be correct.
Show answer without attempting

Loading the answer…

Q47

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

Report a problem with Q47

What is wrong?
Consider the following Python code snippet.
A={"this","that"}
B={"that","other"}
C={"other","this"}
while "other" in C:
    if "this" in A:
        A,B,C=A-B,B-C,C-A
    if "that" in B:
        A,B,C=C|A,A|B,B|C
When the above program is executed, at the end, which of the following sets contains "this"?
Show answer without attempting

Loading the answer…

Q58

GATE DA 2025 DAGraph Theory and Graph AlgorithmsMSQ2 marks

Report a problem with Q58

What is wrong?
Let GG be a simple, unweighted, and undirected graph. A subset of the vertices and edges of GG are shown below.

It is given that a−b−c−da - b - c - d is a shortest path between aa and dd; e−f−g−he - f - g - h is a shortest path between ee and hh; a−f−c−ha - f - c - h is a shortest path between aa and hh. Which of the following is/are NOT the edges of GG?
Question figure
More than one option can be correct.
Show answer without attempting

Loading the answer…

Q63

GATE DA 2025 DAProgramming in PythonNAT2 marks

Report a problem with Q63

What is wrong?
Consider the following Python code snippet.
def f(a,b):
    if (a==0):
        return b
    if (a%2==1):
        return 2*f((a-1)/2,b)
    return b+f(a-1,b)

print(f(15,10))
The value printed by the code snippet is __________ (Answer in integer)
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…

Q65

GATE DA 2025 DAGraph Theory and Graph AlgorithmsNAT2 marks

Report a problem with Q65

What is wrong?
Consider a directed graph G=(V,E)G = (V, E), where V={0,1,2,…,100}V = \{0, 1, 2, \ldots, 100\} and E={(i,j):0<j−i≤2,for all i,j∈V}E = \{(i, j) : 0 < j - i \le 2, \text{for all } i, j \in V\}. Suppose the adjacency list of each vertex is in decreasing order of vertex number, and depth-first search (DFS) is performed at vertex 0. The number of vertices that will be discovered after vertex 50 is __________ (Answer in integer)
Show answer without attempting

Loading the answer…

0/90 correct0 marks

Related topics in GATE DA