You are on page 1of 13


Suppose a binary tree has only three nodes A, B, and C, and you are given
that the post-order traversal for the tree is B-A-C. The pre-order traversal
for the tree is:
a. C-A-B
b. A-B-C
c. C-B-A
d. A definite pre-order traversal cannot be determined from the information given
2. Every graph has a unique minimum spanning tree.
A. True
B. False
3. You can implement a Depth First Traversal using a Queue.
A. True
B. False
4. Which algorithm strategy allows us to efficiently compute the minimal spanning tree of a
A. Greedy Method
B. Dynamic Programming
C. Traversal of graph
D. Divide and conquer.
5. Match the following
(P) Prims algorithm for minimum spanning tree

(i) Backtracking

(Q) Floyd-Warshall algorithm for all pairs shortest paths

(ii) Greedy method

(R) Mergesort

(iii) Dynamic programming

(S) Hamiltonian circuit

(iv) Divide and conquer

A. P iii,Qii,Riv,Si
B. P i, Q ii, R iv, S iii
C. P ii, Q iii, R iv, S i
D. P ii, Q i, R iii, S iv

6. The height of a tree is the length of the longest root-to-leaf path in it. The maximum and
minimum number of nodes in a binary tree of height 5 are
(A) 63 and 6, respectively
(C) 32 and 6, respectively
(B) 64 and 5, respectively
(D) 31 and 5, respectively
7.The graph shown below 8 edges with distinct integer edge weights. The minimum spanning
(MST) is of weight 36 and contains the edges: {(A, C), (B, C), (B, E), (E, F), (D, F)}. The edge
weights of only those edges which are in the MST are given in the figure shown below. The
minimum possible sum of weights of all 8 edges of this graph is ______________.





A. 69
B. 36
C. 77

8.How many spanning trees are possible for the following graph

A. 3
B. 2
C. 4
D. 1
9. What is the optimal solution for the knapsack with M=15 P= { 4,2,2,1,10} W={ 12,1,2,1,4}
A. 15.4
B. 17.33
C. 20.5
D. 16.5
10. Algorithm based on greedy techniques are used for solving..........
A. Linear Problem
B. Optimization problem
C. Quadratic Problem
D. Bi-quadratic problem
11. The length of the shortest path from A to D is....
A. 11
B. 12
C. 9
D. 6
12.In Optimal merge patterns for Files having sizes are 3, 7, 8, 9, 15, and 16 the total record
movements are _____
A. 143
B. 113
C. 58
D. 108
13. For Optimal Solution of Job sequencing with deadline we consider objects ___
A. In decreasing order of Deadline.
B. In increasing order of Deadline.
C. In decreasing order of profit.
D. In increasing order of profit.
14.An adjacency matrix representation of a graph cannot contain information of
A. Nodes
B. Edges

C. Direction of edges
D. Parallel edges
15..The data structure required for breadth first traversal on a graph is
A. Queue
B. Stack
C. Array
D. Tree
16.A vertex in an undirected connected graph is an _________ iff removing it and edges through
it disconnects the graph
A. Join vertex
B. connected point
C. Bi connected Point
D. Articulation point
17.Consider a function that reads numbers of a matrix and outputs the sum of all the entries.
What could be the worst-case complexity of this program?
A. O (n)
B. O (n2)
C. O (n log n)
D. O (log n)
18.Consider the following graph:

Which one of the following is NOT the sequence of edges added to the minimum
spanning tree using Kruskals algorithm?
A. (b,e) (e,f) (a,c) (b,c) (f,g) (c,d)
B. (b,e) (e,f) (a,c) (f,g) (b,c) (c,d)
C. (b,e) (a,c) (e,f) (b,c) (f,g) (c,d)
D. (b,e) (e,f) (b,c) (a,c) (f,g) (c,d)
19.What is the difference between Greedy Method and divide and conquer Method?
A. Greedy algorithm is used for programs in lower level language while divide and conquer
is for program in higher level language
B. Divide and conquer method is used for sorting only, greedy is used for searching
problems only
C. Greedy algorithm is used for problems having multiple solutions to find best among
solutions and Divide & conquer creates sub problems whose solution can be combined

D. All the above options

20.Match the following
Column - I
A. Quick sort
B. Bubble sort
C. Binary search
a. A 3, B 2, C -1
b. A 3, B 1, C -2
c. A 1, B 2, C -3
d. A 1, B 3, C -2

Column - II
1. O( n2)
2. O(log n)
3. O(n logn)

21. The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.
Which one of the following is the postorder traversal sequence of the same tree?
A. 10, 20, 15, 23, 25, 35, 42, 39, 30
B. 15, 10, 25, 23, 20, 42, 35, 39, 30
C. 15, 20, 10, 23, 25, 42, 35, 39, 30
D. 15, 10, 23, 25, 20, 35, 42, 39, 30
22. Graphs are represented using
A. Adjacency tree
B. Adjacency Matrix
C. Adjacency graph
D. Adjacency queue
23. Let A be an adjacency matrix of a graph G. The A[ i, j]th entry in the matrix Ak , gives
A. The number of paths of length K from vertex Vi to vertex Vj.
B. Shortest path of K edges from vertex Vi to vertex Vj.
C. Length of a Eulerian path from vertex Vi to vertex Vj.
D. Length of a Hamiltonian cycle from vertex Vi to vertex Vj.
24. Suppose we run Dijkstras single source shortest-path algorithm on the following edge
weighted directed graph with vertex P as the source. In what order do the nodes get included into
the set of vertices for which the shortest path distances are finalized?

A. A. P, Q, R, S, T, U
B. B.P, Q, R, U, S, T
C. C.P, Q, R, U, T, S

D. D.P, Q, T, R, U, S

25. Suppose the letters a, b, c, d, e, f have probabilities 1/2, 1/4, 1/8, 1/16, 1/32, 1/32
respectively. Which of the following is the Huffman code for the letter a, b, c, d, e, f?
A.0, 10, 110, 1110, 11110, 11111
B.11, 10, 011, 010, 001, 000
C.11, 10, 01, 001, 0001, 0000
D.110, 100, 010, 000, 001, 111
26. The number of distinct minimum spanning trees for the weighted graph below is

B. 4
C. 6
27. The minimum number of arithmetic operations required to evaluate the polynomial P(X) =
X5 + 4X3 + 6X + 5 for a given value of X using only one temporary variable.
(A) 6
(B) 7
(C) 8
(D) 9
28. Which of the following is true about Huffman Coding.
A.Huffman coding may become lossy in some cases
B.Huffman Codes may not be optimal lossless codes in some cases
C.In Huffman coding, no code is prefix of any other code.
D. In Huffman coding, no code is prefix of any other code.
How do you determine the cost of a spanning tree?
A. By the sum of the costs of the edges of the tree
B. By the sum of the costs of the edges and vertices of the tree

C. By the sum of the costs of the vertices of the tree

D. By the sum of the costs of the edges of the graph

31.Which of the following does not belongs to the same algorithm paradigm which
the other belongs to?
A. Minimum & Maximum problem
B. Knapsack problem
C. Selection problem
D. Merge sort

32.The optimal solution to a problem is a combination of optimal solutions to its

sub-problems. This is known as
A. Principleof Duality
B. Principle of Feasibility
C. Principle of Optimality
D. Principle of Dynamicity.

33.In Knapsack problem, the best strategy to get the optimal solution, where Pi, Wi
is the Profit, Weight associated with each of the ith object respectively is to
A. Arrange the values Pi/Wi in ascending order
B. Arrange the values Pi/Xi in ascending order
C. Arrange the values Pi/Wi in descending order
D. Arrange the values Pi/Xi in descending order

34. Breadth first search

A. Scans all incident edges before moving to other vertex

B. Scans adjacent unvisited vertex as soon as possible
C. Is same as backtracking
D. Computes a path between two vertices of graph or equivalently

35.How many minimum number of spanning trees, one can have from a given
connected graph with N nodes is having different weights for the edges.
A. N-1
B. One
C. 1/(N+1)
D. 2N

36.The method will choosing when sub problems share sub problems
A. Divideand conquer
B. Greedy method
C. Dynamic programming
D. Back tracking

37.which is not feasible solution in the case of job sequence problem

item : 1 2 3 4
profit : 100 10 15 27
deadline : 2 1 2 1
A. (1,4)
B. (4,3)
C. (2,4)
D. (1,2)

38. BFS is best compared to DFS in the case of ________________

A. The graphs width is large
B. The graphs depth is large
C. The graph consists of many nodes
D. The graph is complex

39.The files x1,x2,x3 are 3 files of length 30,20,10 records each. What is the optimal
merge pattern value?
A. 110
B. 60
C. 90
D. 50

40. Dijkstras algorithm :

A. Has greedy approach to find all shortest paths
B. Has both greedy and Dynamic approach to find all shortest paths
C. Has greedy approach to compute single source shortest paths to all other
D. Has both greedy and dynamic approach to compute single source shortest paths
to all other vertices.

41.which is optimal value in the case of job sequence problem

item :

1 2 3

4 5 6 7

profit :

3 5 20 18 1 6 30

deadline :

1 3 4

3 2 1 2

A. (1,5,6,4)
B. (2,3,1,7)
C. (7,6,4,3)
D. (1,2,3,4)

42.A text is made up of characters a,b,c,d and e each occuring with the probability
0.12,0.4,0.15,0.08,0.25 respectively.The optimal coding technique will have the
average length of (Use huffman coding)
A. 2.15
B. 3.01
C. 2.3
D. 1.78

43.A spanning tree of a graph is one that includes:

A. All the Vertices of the graph
B.All the edges of the graph
C. Only vertices of odd degree
D.Only vertices of even degree

44.An undirected graph G has n nodes. Its adjacency matrix is given by an n n

square matrix whose (i) diagonal elements are 0s and (ii) non-diagonal elements
are 1s. which one of the following is TRUE?
A. Graph G has no minimum spanning tree (MST)
B. Graph G has a unique MST of cost n-1
C. Graph G has multiple distinct MSTs, each of cost n-1
D. Graph G has multiple spanning trees of different costs

45.Which one of the following cannot be the sequence of edges added, in that
order, to a minimum spanning tree using Kruskals algorithm?

A. (ab),(df),(bf),(dc),(de)
B. (ab),(df),(dc),(bf),(de)
C. (df),(ab),(dc),(bf),(de)
D. (df),(ab),(bf),(de),(dc)

46.Let G be an undirected connected graph with distinct edge weight. Let emax be
the edge with maximum weight and emin the edge with minimum weight. Which of
the following statements is false?
A. Every minimum spanning tree of G must contain emin
B. If emax is in a minimum spanning tree, then its removal must disconnect G
C. No minimum spanning tree contains emax
D. G has a unique minimum spanning tree

47.Let G be 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. 2000
D. 1995

48.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 Which are depth first traversals of the above graph?

A. I, II and IV only
B. I and IV only
C. II, III and IV only
D. I, III and IV only

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