Which of the following statement(s) is/are FALSE?

I: Insertion sort runs faster than merge sort if input sequences are already sorted.

II: Heap sort and selection sort time complexity will not depend on input sequence.

III. Heap sort and Quicksort are not stable algorithms

I and II
II and III
I, II and III
None of the above
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
How many minimum spanning trees(MST) are possible for a given graph is____?

125
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Fill in the blanks for the most suitable answer.

I. Primary Clustering is the tendency for a collision resolution scheme such as _______to create long runs of filled slots near the hash position of keys.

II. Secondary Clustering is the tendency for a collision resolution scheme such as _______to create long runs of filled slots away from the hash position of keys.

Linear probing and Quadratic probing
Linear probing and Linear probing
Quadratic probing and Quadratic probing
Quadratic probing and Linear probing
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Construct max heap for the given an array of elements.

Insert the element 55 after constructing the max heap and Find the value of index 5 is _?

[ Hint: Index of an array starts with 0 ]

36
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Find the minimum number of machines required to schedule all the jobs____?

Job

A

B

C

D

E

F

Start Time

2

3

1

6

7

8

End Time

3

7

4

9

11

12

3
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
The most appropriate matching for the following pairs

List-A

List-B

P: Binary Search Tree

1: Stack

Q: 0/1 knapsack problem

2: Greedy

R: Huffman Coding

3: Dynamic programming

S: Depth-first Search

4: Divide and Conquer

P-2, Q-3, R-4, S-1
P-2, Q-4, R-3, S-1
P-4, Q-3, R-2, S-1
P-4, Q-2, R-3, S-1
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Find the total number of strongly connected components for a given graph is ____?

3
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Given an undirected graph.

Find the total cost of the second best minimum Spanning tree(MST) _____?

[ Note: A second best MST is a spanning tree, that has the second minimum weight sum of all the edges, from all the possible spanning trees of the graph G ]

19
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
What is the length of the longest common subsequence(LCS) of the given below two string X and Y are ____________?

X = pqsprutrts

Y = qrstupqrs

5
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
What is the worst case time to delete a random element in a binary heap?
O(logn)
O(n)
O(nlogn)
O(n^2)
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider a set of 512 elements to find minimum and maximum elements in the given set. Find the minimum number of comparisons required is___?
766
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
How many passes of bubble sort are required to sort the following sequence _______?

A={ 20,16,1,10,13, 15, 9, 12, 11}

[ Hint: Pass is counted only when at least one swap is performed in the bubble sort pass ]

5
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00

Consider two strings A = "zazrpzqrst" and B = "arzazrsatq". Let ‘X’ be the length of the longest common subsequence (not necessarily contiguous) between A and B and let ‘Y’ be the number of such longest common subsequences between A and B.

Find (5x+4y)%(x+y) = ______?

6
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33

Let P be a Quicksort Program to sort numbers in ascending order using the last element as pivot. Let t1 and t2 be the number of comparisons made by P for the inputs {2, 2, 2, 2, 2} and {10, 20, 30, 40, 50} respectively. Which one of the following holds?

t1 = 5

t1< t2

t1 > t2

t1 = t2

Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33

Consider a matrix multiplication chain ABCDE, where matrices A,B,C,D and E are of dimensions 6x7, 7x9, 9x3, 3x7 and 7x8 respectively. In the parenthesization of ABCDE that minimizes the total number of scalar multiplications. Find the correct explicit computed pairs to get the minimum number of scalar multiplications.

[ Hint: For example, in the matrix multiplication chain PQRSTU using parenthesization (P(QR))(S(TU)), QR and TU are only explicitly computed pairs ]

(AB) and (BC)

(BC) and (DE)

Only (BC)

(AB) and (DE)

Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
The inorder traversal of the tree will yield a sorted sequence of elements of the tree in ___
Binary tree
Binary Search Tree
Ternary tree
Heaps
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Suppose the numbers 17, 15, 11, 18, 13, 16, 10, 19, 14, 12 are inserted in that order into an initially empty binary search tree. The binary search tree uses the reversal ordering on natural numbers i.e. 19 is assumed to be smallest and 10 is assumed to be largest. The inorder traversal of the resultant binary search tree is
19, 18, 16, 14, 12, 13, 10, 11, 15, 17
10, 11, 12, 13, 14, 15, 16, 17, 18, 19
10, 12, 14, 13, 11, 16, 15, 19, 18, 17
19, 18, 17, 16, 15, 14, 13, 12, 11, 10
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Given a simple undirected graph with n vertices such that every possible pair of vertices is connected with an edge. How many DFS traversals are possible for such a graph?
N^2
N!
N(N-1)
N(N-1)/2
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
The Pr-eorder and inorder traversal of a Binary tree is as follows:

A B X E M S W T P N C H

E X M B S A P T N W H C

The post-order traversal of the tree is?

H C N P T W S M E X B A
H N C P T W S M E X B A
E M X S N P B T H C W A
E M X S B P N T H C W A
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Which of the following sequences of keys gives the same resultant AVL tree?

I) 7, 6, 5, 4, 3, 2, 1

II) 1, 2, 3, 4, 5, 6, 7

III) 4, 2, 6, 1, 3, 5, 7

IV) 4, 6, 2, 5, 3, 1, 7

I and II only
III and IV only
I and IV only
All of these
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
A circular queue ‘q’ is of size 9 elements. Queue ‘q’ is initially empty and has indices from 0 to 7.

for(i = 1, i< = 8; i++)

q.enqueue(i);

for ( i = 1; i<=7; i++)

{

q.dequeue();

q.enqueue(q.dequeue());

}

Assume enqueue and dequeue are circular operations for insertion and deletion respectively. The number of elements that will remain in the queue after the completion of the program is ___________

0
1
2
3
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
How many labeled Binary Trees can be there with 3 nodes?
14
30
24
18
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
How many distinct BST can be created out of 5 distinct keys?
48
42
1040
1046
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
What does the following code snippet output?

x = [1, 2, 3]

y = x

y += [4, 5]

print(x, y)

[1, 2, 3] [1, 2, 3, 4, 5]
[1, 2, 3] [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5] [1, 2, 3, 4, 5]
Error
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
What will be the output of the following code?

def func(a, b, c, d):

print(a, b, c, d)

a = (1, 2)

k = {'c': 3, 'd': 4}

func(*a, **k)

1 2 3 4
TypeError: func() missing 2 required positional arguments
TypeError: func() got multiple values for argument 'c'
SyntaxError: invalid syntax
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
What will be the output of the following code?

def generator():

yield "Hello"

yield "World"

g = generator()

print(next(g))

print(next(g))

print(next(g, "Done"))

Hello World Done
Hello World StopIteration
Hello World None
Hello StopIteration Done
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following Python function:

def fun(arr):

for i in range(1, len(arr)):

arr[i] += arr[i - 1]

return arr

What does this Python function fun() do?

It calculates the cumulative sum of the list arr.
It calculates the prefix sum array of the list arr.
It sorts the list arr in ascending order.
It reverses the list arr.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following Python function:

def fun(arr, start, end):

if start < end:

arr[start], arr[end] = arr[end], arr[start]

fun(arr, start + 1, end - 1)

What does this Python function fun() do?

It swaps the elements in the list arr at indices start and end, and leaves the remaining elements unchanged.
It reverses the list arr between indices start and end, both inclusive.

It sorts the list arr in ascending order between indices start and end.
It finds the maximum element in the list arr between indices start and end, both inclusive.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following Python function:

def fun(arr):

def helper(l, r):

if l > r:

return 0

return max(arr[l] - helper(l + 1, r), arr[r] - helper(l, r - 1))

return helper(0, len(arr) - 1)

arr = [20, 30, 2, 2, 2, 10]

print(fun(arr))

What is the output of the above code?

20
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider the following Python function:

def fun(n):

if n == 0:

return 0

if n % 2 == 0:

return n + fun(n - 1)

else:

return fun(n // 2)

print(fun(10))

14
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider the following Python function:

def fun(arr, start, end):

if start >= end:

return 0

if (end - start) % 2 == 0:

return arr[end] - arr[start] + fun(arr, start + 1, end - 1)

else:

return max(fun(arr, start + 1, end), fun(arr, start, end - 1))

arr = [7, 1, 3, 4, 8, 2]

print(fun(arr, 0, len(arr) - 1))

6
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider the following Python function:

def fun(lst):

result = []

for i in range(len(lst)):

if i % 2 == 0:

result.extend(lst[:i+1])

else:

result.extend(lst[i:])

return result

lst = [1, 2, 3, 4, 5]

print(fun(lst))

[1, 1, 2, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
[5, 4, 3, 2, 1, 5, 4, 3, 2, 1, 2, 3, 4]
[2, 1, 1, 1, 2, 4, 4, 5, 1, 2, 3, 4, 5]
[1, 1, 2, 1, 2, 4, 3, 1, 5, 2, 3, 4, 5]
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following Python code:

def fun(n):

result = 1

for i in range(2, n + 1):

result = (result * i) // (i % 3 + 1)

return result

n = 6

print(fun(n))

What are the possible correct output?

0
20
40
60
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66