wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

unit-5 test-1

Total questions: 15

Worksheet time: 47mins

Name
Class
Date
1.

Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex t at a distance four from the root. If t is the n-th vertex in this BFS traversal, then the maximum possible value of n is ___________.

a)

29

b)

30

c)

31

d)

32

2.

Consider the following directed graph:

The number of different topological orderings of the vertices of the graph is ________________.

a)

5

b)

6

c)

7

d)

8

3.

Let G be a graph with n vertices and m edges. What is the tightest upper bound on the running time of Depth First Search on G, when G is represented as an adjacency matrix?

a)
O(n log n)
b)
O(n!)
c)
O(m^2)
d)
O(n^2)
4.

Suppose depth first search is executed on the graph below starting at some unknown vertex. Assume that a recursive call to visit a vertex is made only after first checking that the vertex has not been visited earlier. Then the maximum possible recursion depth (including the initial call) is _________.

a)

17

b)

18

c)

19

d)

20

5.

Consider the tree arcs of a BFS traversal from a source node W in an unweighted, connected, undirected graph. The tree T formed by the tree arcs is a data structure for computing

a)
longest paths from the source node to all other nodes in the graph
b)
paths from all nodes to the source node in the graph
c)
random paths from the source node to all other nodes in the graph
d)
shortest paths from the source node to all other nodes in the graph
6.

In a depth-first traversal of a graph G with n vertices,k edges are marked as tree edges. The number of connected components in G is

a)
n - k + 1
b)
n / k
c)
n - k
d)
n + k + 1
7.

Consider the following graph among the following sequences
I. a b e g h f
II. a b f e h g
III. a b f h g e
IV. a f g h b e

a)

I. II.

b)

I. III. IV.

c)

II. III. IV.

d)

I. II. III. IV

8.

Let G be a graph with 100! vertices, with each vertex labelled by a distinct permutation of the numbers 1,2,…,100. There is an edge between vertices U and V if and only if the label of U can be obtained by swapping two adjacent numbers in the label of V. Let y denote the degree of a vertex in G, and 𝑧 denote the number of connected components in G. Then, 𝑦+10𝑧= _____.

a)

110

b)

109

c)

108

d)

107

9.

In an adjacency list representation of an undirected simple graph G=(V,E), each edge (u,v) has two adjacency list entries: [v] in the adjacency list of u, and [u] in the adjacency list of v. These are called twins of each other. A twin pointer is a pointer from an adjacency list entry to its twin. If |E|=m and |V|=n, and the memory size is not a constraint, what is the time complexity of the most efficient algorithm to set the twin pointer in each entry in each adjacency list?

a)
O(m*n)
b)
O(m^2)
c)
O(m+n)
d)
O(n^2)
10.

Let G = (V, E) be a simple undirected graph, and s be a particular vertex in it called the source. For x∈V, let d(x) denote the shortest distance in G from s to x. A breadth first search (BFS) is performed starting at s. Let T be the resultant BFS tree. If (u, v) is an edge of G that is not in T, then which one of the following CANNOT be the value of d(u)−d(v)?

a)

-1

b)

0

c)

1

d)

2

11.

Let G be a connected undirected graph of 100 vertices and 300 edges. The weight of a minimum spanning tree of G is 500. When the weight of each edge of G is increased by five, the weight of a minimum spanning tree becomes ________.

a)

1000

b)

995

c)

1005

d)

1010

12.

Let G be a weighted graph with edge weights greater than one and G' be the graph constructed by squaring the weights of edges in G. Let T and T' be the minimum spanning trees of G and G' respectively, with total weights t and t'. Which of the following statements is TRUE?

a)

T' = T , t'=t2

b)

T' = T , t'<t2

c)

T' != T , t'=t2

13.

Consider a complete undirected graph with vertex set {0,1,2,3,4}. Entry Wij in the matrix W below is the weight of the edge {i, j}

What is the minimum possible weight of a spanning tree T in this graph such that vertex 0 is a leaf node in the tree T?

What is the minimum possible weight of a path P from vertex 1 to vertex 2 in this graph such that P contains at most 3 edges?

a)

7,8

b)

8,9

c)

9,10

d)

10,8

14.

What is the largest integer m such that every simple connected graph with n vertices and n edges contains at least m different spanning trees?

a)

1

b)

2

c)

3

d)

n

15.

Consider the depth-first-search of an undirected graph with 3 vertices P, Q, and R. Let discovery time d(u) represent the time instant when the vertex u is first visited, and finish time f(u) represent the time instant when the vertex u is last visited. Given that
d(P) = 5 units      f(P) = 12 units
d(Q) = 6 units      f(Q) = 10 units
d(R) = 14 unit      f(R) = 18 units
Which one of the following statements is TRUE about the graph

a)

P and Q are conected

b)

R and Q are conected

c)

P and R are conected

d)

P and Q are not connected