Questions 11–20 of 31. Imported answers require independent review unless marked reviewed.

Topic practice 31 questionsPage 2 of 4

Question 23

Open question
daMCQ1 markNeeds review
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]?
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 27

Open question
daMSQ1 markNeeds review
For which of the following inputs does binary search take time

in the worst case?
Your answerSelect all correct options. You can choose more than one.

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 29

Open question
daMSQ1 markNeeds review
Suppose that insertion sort is applied to the array

and it takes exactly two swaps to sort the array. Select all possible values of

.
Your answerSelect all correct options. You can choose more than one.

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 47

Open question
daMCQ2 marksNeeds review
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"?
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 58

Open question
daMSQ2 marksNeeds review
Let

be a simple, unweighted, and undirected graph. A subset of the vertices and edges of

are shown below.
Diagram for Data Science and Artificial Intelligence question 58

It is given that

is a shortest path between

and

;

is a shortest path between

and

;

is a shortest path between

and

. Which of the following is/are NOT the edges of

?
Your answerSelect all correct options. You can choose more than one.

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 63

Open question
daNAT2 marksNeeds review
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)

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
daNAT2 marksNeeds review
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)

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
daNAT2 marksNeeds review
Consider a directed graph

, where

and

. 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)

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 14

Open question
DAMCQ1 markNeeds review
Consider performing depth-first search (DFS) on an undirected and unweighted graph

starting at vertex

. For any vertex

in

,

is the length of the shortest path from

to

. Let

be an edge in

such that

. If the edge

is explored first in the direction from

to

during the above DFS, then

becomes a ______ edge.
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 16

Open question
DAMCQ1 markNeeds review
Match the items in Column 1 with the items in Column 2 in the following table:
Column 1: (p) First In First Out; (q) Lookup Operation; (r) Last In First Out.
Column 2: (i) Stacks; (ii) Queues; (iii) Hash Tables
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