Questions 21–30 of 84. Imported answers require independent review unless marked reviewed.

Topic practice 84 questionsPage 3 of 9

Question 33

Open question
CSNAT1 markNeeds review
The pseudocode of a function fun() is given below:
fun(int A[0,...,n-1]) {
for i=0 to n-2
for j=0 to n-i-2
if (A[j]>A[j+1])
then swap A[j] and A[j+1]
}
Let

be an array storing 30 distinct integers in descending order. The number of swap operations that will be performed, if the function fun() is called with

as argument, is __________. (Answer in integer)

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 37

Open question
CSMCQ2 marksNeeds review
Let

be an edge-weighted undirected graph with positive edge weights. Suppose a positive constant

is added to the weight of every edge.
Which ONE of the following statements is TRUE about the minimum spanning trees (MSTs) and shortest paths (SPs) in

before and after the edge weight update?
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 41

Open question
CSMCQ2 marksNeeds review
An array

of length

with distinct elements is said to be bitonic if there is an index

such that

is sorted in the non-decreasing order and

is sorted in the non-increasing order.
Which ONE of the following represents the best possible asymptotic bound for the worst-case number of comparisons by an algorithm that searches for an element in a bitonic array

?
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 43

Open question
CSMCQ2 marksNeeds review
Let

be an undirected and unweighted graph with 100 vertices. Let

denote the number of edges in a shortest path between vertices

and

in

. Let the maximum value of

,

such that

, be 30. Let

be a breadth-first-search tree of

. Which ONE of the given options is CORRECT for every such graph

?
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 59

Open question
CSNAT2 marksNeeds review
Consider the following algorithm someAlgo that takes an undirected graph

as input.
someAlgo(

)
Let

be any vertex in

. Run BFS on

starting at

. Let

be a vertex in

at maximum distance from

as given by the BFS.
Run BFS on

again with

as the starting vertex. Let

be the vertex at maximum distance from

as given by the BFS.
Output the distance between

and

in

.
Diagram for Computer Science and Information Technology question 59

The output of someAlgo(

) for the tree shown in the given figure is __________. (Answer in integer)

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 64

Open question
CSNAT2 marksNeeds review
The maximum value of x such that the edge between the nodes B and C is included in every minimum spanning tree of the given graph is ______ . (answer in integer)
Diagram for Computer Science and Information Technology question 64


Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 65

Open question
CSNAT2 marksNeeds review
In a double hashing scheme,

and

are the auxiliary hash functions. The size

of the hash table is 11. The hash function for the i-th probe in the open address table is

. The following keys are inserted in the given order: 63, 50, 25, 79, 67, 24.
The slot at which key 24 gets stored is __________. (Answer in integer)

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 15

Open question
CSMCQ1 markNeeds review
Let

be the recurrence relation defined as follows:



and

for

Which one of the following statements is TRUE?
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 17

Open question
CS1MCQ1 markNeeds review
Given an integer array of size N, we want to check if the array is sorted (in either ascending or descending order). An algorithm solves this problem by making a single pass through the array and comparing each element of the array only with its adjacent elements. The worst-case time complexity of this algorithm is
Your answerChoose one option.

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer

Question 35

Open question
CSNAT1 markNeeds review
Let

be an array containing integer values. The distance of

is defined as the minimum number of elements in

that must be replaced with another integer so that the resulting array is sorted in non-decreasing order. The distance of the array

is ________

Log in to check the answer

You can attempt this question now. Sign in to view the answer key, explanations and discussion.Log in to check answer