25
VELAMMAL COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY Aptitude Question Bank Subject code/Name: CS6402/Design and Analysis of Algorithms Year/Sem: II/IV Batch: 2016 – 2020 UNIT I -INTRODUCTION Notion of an Algorithm – Fundamentals of Algorithmic Problem Solving – Important Problem Types – Fundamentals of the Analysis of Algorithm Efficiency – Analysis Framework – Asymptotic Notations and its properties – Mathematical analysis for Recursive and Non-recursive algorithms. 1.Consider a linked list of n elements. What is the time taken to insert an element after an element pointed by some pointer? A. O (1) B. O (n) C. O (log 2 n) D .O (n log 2 n) Answer A 2.An algorithm is made up of two independent time complexities f (n) and g (n). Then the complexities of the algorithm is in the order of A. f(n) x g(n) B. Max ( f(n),g(n)) C. Min (f(n),g(n)) D. f(n) + g(n) Answer B 3.Two main measures for the efficiency of an algorithm are A. Processor and memory B. Complexity and capacity C. Time and space D. Data and space Answer C 4.The total number of comparisons in a bubble sort is A. 0(log n) B. 0(n log n) C. 0(n) D. None of the above Answer B 5.Time complexities of three algorithms are given. Which should execute the slowest for large values of N?

sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

VELAMMAL COLLEGE OF ENGINEERING AND TECHNOLOGY

DEPARTMENT OF INFORMATION TECHNOLOGY

Aptitude Question Bank

Subject code/Name: CS6402/Design and Analysis of Algorithms

Year/Sem: II/IV Batch: 2016 – 2020

UNIT I -INTRODUCTION

Notion of an Algorithm – Fundamentals of Algorithmic Problem Solving – Important Problem Types – Fundamentals of the Analysis of Algorithm Efficiency – Analysis Framework – Asymptotic Notations and its properties – Mathematical analysis for Recursive and Non-recursive algorithms.

1.Consider a linked list of n elements. What is the time taken to insert an element after an element pointed by some pointer?

A. O (1) B. O (n) C. O (log2 n) D .O (n log2 n)

Answer A2.An algorithm is made up of two independent time complexities f (n) and g (n). Then the complexities of the algorithm is in the order of

A. f(n) x g(n) B. Max ( f(n),g(n)) C. Min (f(n),g(n)) D. f(n) + g(n)

Answer B

3.Two main measures for the efficiency of an algorithm are

A. Processor and memory B. Complexity and capacity C. Time and space D. Data and space

Answer C

4.The total number of comparisons in a bubble sort is

A. 0(log n) B. 0(n log n) C. 0(n) D. None of the above

Answer B

5.Time complexities of three algorithms are given. Which should execute the slowest for large values of N?

A. ( 1 2 ) O N B. O(N) C. O(log N) D. None of these

Answer B6.The upper bound of computing time of m coloring decision problem is

Page 2: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

A. O(nm) B .O(nm) C. O(nmn) D. O(nmmn)

Answer C

7.The space factor when determining the efficiency of algorithm is measured by

A. Counting the maximum memory needed by

the algorithm B. Counting the minimum memory

needed by the algorithm C. Counting the

average memory needed by the algorithm

D. Counting the maximum disk space needed by the algorithm

Answer A

8.If the address of A[1][1] and A[2][1] are 1000 and 1010 respectively and each element occupies 2 bytes then the array has been stored in order.

A. row major B. column major C. matix major D. none of these

Answer A

9.The time factor when determining the efficiency of algorithm is measured by

A. Counting microseconds

B. Counting the number of key operations

C. Counting the number of statements

D. Counting the kilobytes of algorithm

Answer B

10.The Worst case occur in linear search algorithm when

A. Item is somewhere in the middle of the array

B. Item is not in the array at all

C. Item is the last element in the array

D. Item is the last element in the array or is not there at all

Answer D

11.A list of n strings, each of length n, is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of

Page 3: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

this computation is

A. O (n log n) B. O (n2 log n) C. O (n2 + log n) D. O (n2)

Answer A

12. Which of the following case does not exist in complexity theory

A. Best case B. Worst case C. Average case D. Null case

Answer D

13. The minimum number of multiplications and additions required to evaluate the polynomial P =4x3+3x2-15x+45 is

A. 6 & 3 B. 4 & 2 C. 3 & 3 D. 8 & 3

Answer C

14. The concept of order Big O is important because

A. It can be used to decide the best algorithm that solves a given problem

B. It determines the maximum size of a problem that can be solved in a given given amount of time

C. It is the lower bound of the growth rate of algorithm

D. Both A and B

Answer A

15.Consider the following pseudo-code : If (A > B) and (C > D) thenA = A + 1B = B + 1EndifThe cyclomatic complexity of the pseudo-code is

A. 2 B. 3 C. 4 D. 5

Answer D

16. The recurrence relation capturing the optimal execution time of the Towers of Hanoi problem with n discs is

A. T(n) = 2T(n - 2) + 2B. T(n) = 2T(n - 1) + nC. T(n) = 2T(n/2) + 1D. T(n) = 2T(n - 1)

Page 4: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

17. Analysis of Selection Sort ends up with

T(n) T(1/1+n) T(n/2) T((n/2) +n)

18. How many elements do we eliminate each time for the Analysis of Selection Algorithm?

(n / 2)+n Elements n / 2 Elements n / 4 Elements 2 n Elements

19. The Sieve Sequence is a special case where the number of smaller sub problems is just____.

4 Many 1 Few

20. The Analysis of Selection Sort shows that the total running time is indeed ____in n?

Geometric Linear Arithmetic Algebraic

21. For the sieve technique we solve the problem

Recursively Randomly Mathematically Precisely

22.How much time merger sort takes for an array of numbers?

T(n^2) T(n) T(log n) T(n log n)

23.O-notation provides an asymptotic a) upper bound c) light bound b) lower bound d) none of these

24.In which sorting technique at every step each element is placed in its proper position? a) Bubble sort c) Quick sort

b) Merge sort d) Heap sort

Page 5: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

25. The upper bound on the time complexity of the nondeterministic sorting algorithm is

(a) O(n) (b) O(n log n) (c) O(1) (d) O( log n) (e) O(n2).

Ans: O(n)

26. For analyzing an algorithm, which is better computing time?

(a)O (100 Log N) (b) O (N) (c)O (2N) (d) O (N logN) (e) O (N2).

Ans :O (100 Log N)

UNIT II - BRUTE FORCE AND DIVIDE-AND-CONQUERBrute Force - Closest-Pair and Convex-Hull Problems-Exhaustive Search - Traveling Salesman Problem -Knapsack Problem - Assignment problem. Divide and conquer methodology – Merge sort – Quick sort – Binary search – Multiplication of Large Integers – Strassen‟s Matrix Multiplication-Closest-Pair and Convex-Hull

1.T is a search tree of order M, its size is N, and its height is K. The computation time needed to INSERT/DELETE a data item on T is

(a) O( 1 ) (b) O( M )(c) O( Log K ) (d) O( K )Answer : D

2. Five statements about B-trees are below. Four of them are correct. Which one isINCORRECT?

(a) All B-trees are also search trees(b) The word B-tree stands for balanced tree(c) The word B-tree also stands for binary tree(d) All leaves of a B-tree must be on the same levelAnswer : C

3.For any B-tree of height H (H>1), after inserting a new key, is it possible for a key, K, which was located in a leaf-node to move up to the root in this regard which of the following is correct?

(a) Can’t be defined without data(b) Never(c) Yes, only if H=2 (d) YesAnswer : D

Page 6: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

4.When we say the order of a tree is M, we mean

(a) Every non-leaf node must have M subtrees(b) Every non-leaf node must have M keys(c) Every non-leaf node can have at most M subtrees(d) Every non-leaf node can have at most M keysAnswer : C

5.In an arbitrary tree ( not a search tree) of order M. Its size is N, and its height is K. The computation time needed to find a data item on T is

(a) O(K*K) (b) O(M*M) (c) O(N)(d) O(K) Answer : C

6.For the bubble sort algorithm, what is the time complexity of the best/worst case? (assume that the computation stops as soon as no more swaps in one pass)

(a) best case: O(n) worst case: O(n*n)(b) best case: O(n) worst case: O(n*log(n))(c) best case: O(n*log(n)) worst case: O(n*log(n)) (d) best case: O(n*log(n)) worst case: O(n*n)

Answer : A

7.For the quick sort algorithm, what is the time complexity of the best/worst case?

(a) best case: O(n) worst case: O(n*n)(b) best case: O(n) worst case: O(n*log(n))(c) best case: O(n*log(n)) worst case: O(n*log(n)) (d) best case: O(n*log(n)) worst case: O(n*n)Answer : D

8.The postfix form of A*B+C/D is

A. *AB/CD+ B. AB*CD/+C. A*BC+/D D. ABCD+/*

9.When converting binary tree into extended binary tree, all the original nodes in binary tree are

A. internal nodes on extended

Page 7: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

tree B. external nodes on extended tree C. vanished on extended treeD. None of above

10.One can make an exact replica of a Binary Search Tree by traversing it in

B. Inorder B. Preorder C. Postorder D. Any order11.The goal of hashing is to produce a search that takes

A. O(1) timeB. O(n2 ) timeC. O(log n ) timeD. O(n log n ) time

12.Which of the following sorting algorithm is of divide-and-conquer type?

A. Bubble sort B. Insertion sort C. Quick sortD. All of above

13.The pre-order and post order traversal of a Binary Tree generates the same output. The tree can have maximum

A. Three nodes B. Two nodes C. One node D. Any number of nodes

14.The post order traversal of a binary tree is DEBFCA. Find out the preorder traversal.

A. ABFCDE B. ADBFEC C. ABDECF D. ABDCEF

15.A search technique where we keep expanding nodes with least accumulated cost so far is called

A. Hill climbingB. Branch and boundC. Best firstD. Divide and conquer

16.The quick sort algorithm exploit design technique

Page 8: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

A. GreedyB. Dynamic programmingC. Divide and ConquerD. Backtracking

Page 9: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

17.Level of any node of a tree is

A. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its distance from the rootD. None of these

18.Which of the following sorting algorithms has the lowest worst case complexity?

A. Merge sort B. Bubble sort C. Quick sortD. Selection sort

19.Given a binary tree whose inorder and preorder traversal are given byInorder : EICFBGDJHK Preorder : BCEIFDGHJKThe post order traversal of the above binary tree is

A. IEFCGJKHDB B. IEFCJGKHDB C. IEFCGKJHDB D. IEFCGJKDBH

Answer A

20.One can make an exact replica of a Binary Search Tree by traversing it in

A. Inorder B. Preorder C. Postorder D. Any order

Answer B

21.Leaves of which of the following trees are at the same level ?

A. Binary tree B. B-tree C. AVL-tree D. Expression tree

Answer B

22.What is the maximum number of nodes in a B-tree of order 10 of depth 3 (root at depth 0) ?

A. 111 B.999 C. 9999 D. None of the above

Answer D23.The worst case running time to search for an element in a balanced binary search tree with n2nelements is

Page 10: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

A. T(nlogn) B. T(n2n) C. T(n) D. T(logn)

Answer C24.When we say the order of a tree is M, we mean

(a) Every non-leaf node must have M subtrees(b) Every non-leaf node must have M keys(c) Every non-leaf node can have at most M subtrees(d) Every non-leaf node can have at most M keysAnswer : C

25.In an arbitrary tree ( not a search tree) of order M. Its size is N, and its height is K. The computation time needed to find a data item on T is

(a) O(K*K) (b) O(M*M) (c) O(N)(d) O(K) Answer : C

UNIT III - DYNAMIC PROGRAMMING AND GREEDY TECHNIQUEComputing a Binomial Coefficient – Warshal‟s and Floy‟s algorithm – Optimal Binary Search Trees – Knapsack Problem and Memory functions. Greedy Technique– Prim‟s algorithm- Kruskal's Algorithm- Dijkstra's Algorithm-Huffman Trees.

1.A given connected graph G is a Euler graph , if and only if all vertices of G are of

A. Same degree B .Even degree C .Odd degree D. Different degree

Answer B

2.One can convert a binary tree into its mirror image by traversing it in

A. Inorder B. Preorder C. Postorder D. Any order

Answer C

3.Graphs are represented using

A. Adjacency tree B. Adjacency linked list C. Adjacency graph D. Adjacency queue

Answer B

4.The data structure required for breadth first traversal on a graph is

A. Queue B. Stack C. Array D. Tree

Answer A

Page 11: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

5.TreeA. Is a bipartite graphB. With n node contains n-1 edgesC. Is a connected graphD. All of these

Answer D

6.If every node u in G is adjacent to every other node v in G, A graph is said to be

A. Isolated B. Complete C. Finite D. Strongly Connected

Answer B

7.Leaves of which of the following trees are at the same level ?

A. Binary tree B. B-tree C. AVL-tree D. Expression tree

Answer B

8.Let A be an adjacency matrix of a graph G. The th ij entry in the matrix K A , 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.

Answer B

9. A graph in which all nodes are of equal degree is called

A. Multi graph B. Non regular graph C. Regular graph D. Complete graph

Answer C

10. The time complexity to build a heap of n elements is

A. 0(1) B. 0(lgn) C. 0(n) D. 0(nlgn)

Answer D

11.If every node u in G is adjacent to every other node v in G, A graph is said to be

A. Isolated B. Complete C.

Page 12: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

FiniteD. Strongly Connected

Answer:B

12.Level of any node of a tree is

A. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its distance from the rootD. None of these

13.A search technique where we keep expanding nodes with least accumulated cost so far is called

A. Hill climbingB. Branch and boundC. Best firstD. Divide and conquer

14.The spanning tree of connected graph with 10 vertices contains

A. 9 edges B. 11 edges C. 10 edges D.10 vertices

15.Two isomorphic graphs must have

A. Equal number of verticesB. Same number of edgesC. Same number of verticesD. All of the above

16.The worst time complexity of the Floyd’s algorithm is O(n3). II. The worst time complexity of the Warshall’s algorithm is O(n3).

(a) (I) is false but (II) is true (b) (I) is true but (II) is false (c) Both (I) and (II) are true (d) (I) is true and (II) is not true always

(e) Both (I) and (II) are false.

Ans :Both (I) and (II) are true

17.Which of the following belongs to the algorithm paradigm?

Page 13: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

(a) Minimum & Maximum problem (b) Knapsack problem (c) Selection problem (d) Merge sort (e) Quick sort.

Ans : Knapsack problem

18.From the following choose the one which belongs to the algorithm paradigm other than to which others from the following belongs to. (a) Minimum & Maximum problem

(b) Knapsack problem (c) Selection problem (d) Merge sort Ans : Knapsack problem

19.Pick the correct statement(s) from the following set of statements.

II. In Prim’s algorithm, for the construction of minimal spanning tree for a graph, the selected edges always form an orchard.

III. DFS, BFS algorithms always make use of a queue, and stack respectively.

(a) Only (I) above

(b) Only (II) above (c) Only (III) above (d) Both (I) and (III) above

Ans : Only (I) above

20.Suppose that we have a data file containing records of famous people, and we need to build a hash table to find a record from the person's birthday. The size of the hash table is4096. The following are hash functions which convert a birthday to an integer. Which of the following function is the best?

(a) h1( day/month/year ) = day + month + year(b) h2( day/month/year ) = day + month*31 + year(c) h3( day/month/year ) = (day + month*31 + year*365) mod 4096 (d) h4( day/month/year ) = (day + month*31 + year*365) mod 4093Answer

Page 14: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

UNIT IV - ITERATIVE IMPROVEMENTThe Simplex MeFthod-The Maximum-Flow Problem – Maximm Matching in Bipartite Graphs- The Stable

1.When we say the order of a tree is M, we mean

(a) Every non-leaf node must have M subtrees(b) Every non-leaf node must have M keys(c) Every non-leaf node can have at most M subtrees(d) Every non-leaf node can have at most M keysAnswer : C

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

Ans : Principle of Optimality

3.Identify the correct problem for multistage graph from the list given below.

(a) Resource allocation problem (b) Traveling salesperson problem (c) Producer consumer problem (d) Barber’s problem

Ans : Resource allocation problem

4.How many edges are there in a Hamiltonian cycle if the edge cost is ‘c’ and the cost of cycle is ‘cn’

(a)c (b) cn

(c)n (d) 2c

Ans :n.

5.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) 2NCN (d) 2NCN

Page 15: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

Ans: one

6.Prims algorithm is based on _____________ method

a. Divide and conquer method

c. Dynamic programming

b. Greedy method d. Branch and bound

Ans. Greedy Method

7.The output of Kruskal and Prims algorithm is ________________

a. Maximum spanning tree

c. Spanning tree

b. Minimum spanning tree

d. None of these

Ans. Minimum spanning tree

8.In the case of Fibnocci heap the running time of Prim's algorithm is _________ a. O(E log V) b. O(V log E) c. O( log V) d. O(E log E)

Ans. O(E log V)

9.If the graph is represented as an adjacency matrix then the time complexity of Kruskal's algorithm is ____________ a. O(E log V) b. O(VlogE)

c. O(V2) d. O(logE)

Ans. O(E log V)

10.The standard form in simplex method is used to find _________A. Extreme points B. Feasible points C. feasible region D. Objective

function

11.Maximum flow of the network is equal to _______A. cut value B. Min Cut value C. Max cut value D. Max Flow Value

Page 16: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

12.The diagonal of the adjacency matrix of a graph with a self loop contains ______A. 1 B. -1 C. 0 D. Both 0 or 1

13.Extreme point theorem is used to find ________

A. Sequence adjacent points B. Optimal Solution

14.Which is not an example of iterative improvement method?A. Greedy technique B. Stable Marriage Problem C. Simplex

Method

15.For an undirected graph with n vertices and e edges, the sum of the degree of each vertex is equal to _____

A. 2n B. (2n-1)/2 C. 2e D. e2/2

UNIT V - COPING WITH THE LIMITATIONS OF ALGORITHM POWERLimitations of Algorithm Power-Lower-Bound Arguments-Decision Trees-P, NP and NP-Complete Problems--Coping with the Limitations - Backtracking – n-Queens problem – Hamiltonian Circuit Problem – Subset Sum Problem-Branch and Bound – Assignment problem – Knapsack Problem – Traveling Salesman Problem- Approximation Algorithms for NP – Hard Problems – Traveling Salesman problem – Knapsack problem.

1.The number of distinct simple graphs with up to three nodes are

A. 15 B. 10 C. 7 D. 9

Answer C

2.The number of unused pointers in a complete binary tree of depth 5 is

A. 4 B. 8 C. 16 D. 32

Answer C

3. Graph Coloring is which type of algorithm design strategy

a. Backtacking c. Greedy

b. Branch and Bound d. Dynamic programming

Ans : Backtracking

4.Which is true statement in the following?

a. Kruskal’salgorithm is multiple source technique for finding MST.

Page 17: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

b. Kruskal’s algorithm is used to find minimum spanning tree of a graph, time complexity of this algorithm is O(EV) c. Both of above

d. Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best Tree edge) when the graph has relatively few edges )

Ans:Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best Tree edge) when the graph hasrelatively few edges )

5.Graphs are represented using

A. Adjacency tree B. Adjacency linked list C. Adjacency graph D. Adjacency queue

Answer BAssuming P ? NP, which of the following is TRUE?

6.NP-complete = NP B. NP-completenP=theta C. NP-hard = NP D. P = NP-complete

Answer B

7.If there is an NP complete language L whose complement is in NP ,then complement of any language in NP is in

A. P B. NP C. Both A and B D. None of these

Answer B

8.Both P and NP are closed under the operation ofA. Union B. Intersection C. Concatenation D. Kleene

Answer D

9. Two isomorphic graphs must have

A. Equal number of verticesB. Same number of edgesC. Same number of verticesD. All of the above

10.T is a search tree of order M, its size is N, and its height is K. The computation time needed to INSERT/DELETE a data item on T is

(a) O( 1 ) (b) O( M )(c) O( Log

Page 18: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

K ) (d) O( K )Answer : D

11.Suppose that we have a data file containing records of famous people, and we need to build a hash table to find a record from the person's birthday. The size of the hash table is4096. The following are hash functions which convert a birthday to an integer. Which of the following function is the best?

(a) h1( day/month/year ) = day + month + year(b) h2( day/month/year ) = day + month*31 + year(c) h3( day/month/year ) = (day + month*31 + year*365) mod 4096 (d) h4( day/month/year ) = (day + month*31 + year*365) mod 4093Answer : D

12.The advantage of selecting maxmin algorithm using divide and conquer method compared to staightmaxmin algorithm is _____

a. Less time complexity

c. High accuracy

b. Less space complexity

d. High time complexity

Ans. Less time complexity

13.BFS is best compared to DFS in the case of ________________ a. The graph’s width is large b. The graph’s depth is large c. The graph consists of many nodes d. The graph is complex

Ans. The graph’s depth is large

14. A given connected graph G is a Euler graph , if and only if all vertices of G are of

A. Same degree B .Even degree C .Odd degree D. Different degree

Answer B

15.What is the maximum number of nodes in a B-tree of order 10 of depth 3 (root at depth 0) ?

A. 111 B.999 C. 9999 D. None of the above

Page 19: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

Answer D

16.One can convert a binary tree into its mirror image by traversing it in

A. Inorder B. Preorder C. Postorder D. Any order

Answer C

17.Graphs are represented using

A. Adjacency tree B. Adjacency linked list C. Adjacency graph D. Adjacency queue

Answer B

18.The data structure required for breadth first traversal on a graph is

A. Queue B. Stack C. Array D. Tree

Answer A

19.Graph Coloring is which type of algorithm design strategy

a. Backtacking c. Greedy

b. Branch and Bound d. Dynamic programming

Ans : Backtracking

20.A problem L is NP-complete iff L is NP-hard and

(a) L ≈ NP (b) L α NP (c) L ε NP (d) L = NP

Ans : L ε NP

21.Time complexity of 4-queen problem a. O(|V|)

b. O(|E|)

c. O(|V|+|E|)

d. O(|V2|)

Ans.O(|V|+|E|)

Page 20: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its

22.BFS is best compared to DFS in the case of ________________ a. The graph’s width is large b. The graph’s depth is large c. The graph consists of many nodes d. The graph is complex

Ans. The graph’s depth is large

23.Graph Coloring is which type of algorithm design strategy

a. Backtacking c. Greedy

b. Branch and Bound d. Dynamic programming

Ans : Backtracking

24.Which of the following statements are TRUE?(1) The problem of determining whether there exists a cycle in an undirected graph is in P. (2) The problem of determining whether there exists a cycle in an undirected graph is in NP.(3) If a problem A is NP-Complete, there exists a non-deterministic polynomial time algorithm to solve A.

A. 1,2 and 3 B. 1 and 2 only C. 2 and 3 only D. 1 and 3 only25.

A. A B. B C. C D. D

Course In-charge Module Coordinator HoDMr.P.Suresh Babu Mrs.D.Anandhavalli Dr.R.Perumaraja

Page 21: sureshvcetit.files.wordpress.com · Web viewA. Height of its left subtree minus height of its right subtree B. Height of its right subtree minus height of its left subtree C. Its