You are on page 1of 8

2017_DS_LP3_5G 20 minutes

Question - 1 SCORE: 2 points


MCQ

Which of the following is an advantage of adjacency list


representation over adjacency matrix representation of
a graph?

In adjacency list representation, space is saved for sparse


graphs.

DFS and BSF can be done in O(V + E) time for adjacency list
representation. These operations take O(V^2) time in adjacency
matrix representation. Here is V and E are number of vertices
and edges respectively.

Adding a vertex in adjacency list representation is easier than


adjacency matrix representation.

All of the
above

Question - 2 SCORE: 2 points


MCQ

The degree sequence of a simple graph is the sequence


of the degrees of the nodes in the graph in decreasing
order.

Which of the following sequences can not be the degree


sequence of any graph?

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

II. 6, 6, 6, 6, 3, 3, 2, 2

III. 7, 6, 6, 4, 4, 3, 2, 2

IV. 8, 7, 7, 6, 4, 2, 1, 1

I and
II

III and
IV

II and
IV

I and
IV

Question - 3 SCORE: 2 points


MCQ

How many undirected graphs (not necessarily


connected) can be constructed out of a given set V= {V
1, V 2,…V n} of n vertices ?

2^(n(n-1)/2)

n!

2^n

n(n-l)/2

Question - 4 SCORE: 2 points


MCQ

Which of the following statements is/are TRUE for an


undirected graph?

P: Number of odd degree vertices is even

Q: Sum of degrees of all vertices is even

P Only

Q Only

Both P and
Q

Neither P nor
Q

Question - 5 SCORE: 2 points


MCQ

Given an undirected graph G with V vertices and E


edges, the sum of the degrees of all vertices is:

2V

2E

Question - 6 SCORE: 2 points


MCQ

A hash table of length 10 uses open addressing with


hash function h(k)=k mod 10, and linear probing.

After inserting 6 values into an empty hash table, the


table is as shown below:
Which one of the following choices gives a possible
order in which the key values could have been inserted
in the table?

46, 42, 34, 52, 23,


33

46, 34, 42, 23, 52,


33

34, 42, 23, 52, 33,


46

42, 46, 33, 23, 34,


52

Question - 7 SCORE: 2 points


MCQ

A hash table of length 10 uses open addressing with


hash function h(k)=k mod 10, and linear probing.

After inserting 6 values into an empty hash table, the


table is as shown below:

How many different insertion sequences of the key


values using the hash function and linear probing will
result in the hash table shown above?

20

30

40

50

Question - 8 SCORE: 2 points


MCQ
Consider a hash table of size seven, with starting index
zero, and a hash function (3x + 4)mod7.

Assuming the hash table is initially empty, which of the


following is the contents of the table

when the sequence 1, 3, 8, 10 is inserted into the table


using closed hashing?

Note that ‘_’ denotes an empty location in the table.

1, 8, 10, _, _, _,
3

8, _, _, _, _, _,
10

1, 10, 8, _, _, _,
3

1, _, _, _, _,
_,3

Question - 9 SCORE: 2 points


MCQ

The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an
initially empty hash table of length 10 using open addressing
with hash function h(k) = k mod 10 and linear probing. What is
the resultant hash table?

Question - 10 SCORE: 2 points


MCQ

Given the following input (4322, 1334, 1471, 9679,


1989, 6171, 6173, 4199)
and the hash function x mod 10, which of the following
statements are true?
i. 9679, 1989, 4199 hash to the same value
ii. 1471, 6171 has to the same value
iii. All elements hash to the same value
iv. Each element hashes to a different value
i only

i and ii
only

iii or
iv

iv only

Question - 11 SCORE: 2 points


MCQ

Which of the following is true?

A graph may contain no edges and many


vertices

A graph may contain many edges and no


vertices

A graph may contain no edges and no


vertices

None of the
mentioned

Question - 12 SCORE: 2 points


MCQ

An advantage of chained hash table (external hashing) over the


open addressing scheme is:

Deletion is
easier

Space used is
less

Worst case complexity of search operations is


less

None of the
above

Question - 13 SCORE: 2 points


MCQ

What would be the DFS graph traversal of the graph given below,
assuming source is 2?

2103
2031

2310

2013

Question - 14 SCORE: 2 points


MCQ

The time complexity to calculate the number of edges in a graph


whose information in stored in form of an adjacency matrix is
____________

O(E^2)

O(V^2)

O(E)

O(V)

Question - 15 SCORE: 2 points


MCQ

For the adjacency matrix of a directed graph the row sum is the
_________ degree and the column sum is the ________ degree.

out, in

in, out

in, total

total, out

Question - 16 SCORE: 2 points


MCQ

Insert the characters of the string K R P C S N Y T J M into a


hash table of size 10. Use the hash function

h(x) = ( ord(x) – ord("a") + 1 ) mod10

and linear probing to resolve collisions.

Which insertions cause collisions ?


C, J,
M

T, J,
M

J,M

C, T, J,
M

Question - 17 SCORE: 2 points


MCQ

What is a hash table?

A structure used to implement stack and


queue

A structure that maps values to


keys

A structure that maps keys to


values

A structure used for


storage

Question - 18 SCORE: 2 points


MCQ

If several elements are competing for the same bucket


in the hash table, what is it called?

Replication

Diffusion

Collision

None of the
mentioned

Question - 19 SCORE: 2 points


MCQ

What is direct addressing?

Fewer array positions than


keys

Distinct array position for every possible


key

Fewer keys than array


positions

None of the
mentioned
Question - 20 SCORE: 2 points
MCQ

In simple chaining, what data structure is


appropriate(best for insertion,deletion and traversal)?

Singly linked
list

Doubly linked
list

Circular linked
list

Binary trees

Question - 21 SCORE: 2 points


MCQ

Which of these adjacency matrices represents a simple


graph?

A simple graph must have no-self loops, should be an


un-directed graph.

[ [0, 0, 1], [1, 0, 1], [1, 0, 0]


]

[ [1, 0, 0], [0, 1, 0], [0, 1, 1]


]

[ [1, 1, 1], [1, 1, 1], [1, 1, 1]


]

[ [0, 0, 1], [0, 0, 0], [0, 0, 1]


]

You might also like