DAA-BITS-Qbank PDF - Objective Type Questions
Document Details
Uploaded by GuiltlessCornflower
BITS Pilani
Tags
Summary
This document contains a set of objective type questions and solutions on algorithms and data structure. Questions cover topics like time and space complexity, different sorting algorithms, graph algorithms, and more.
Full Transcript
Objective Type Questions with Solutions 1. 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 2. The time factor when determining the efficiency of algorith...
Objective Type Questions with Solutions 1. 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 2. 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 3. Which of the following case does not exist in complexity theory a. Best case b. Worst case c. Average case d. Null case 4. The Knapsack problem where the objective function is to minimize the profit is ______ a. Greedy b. Dynamic 0 / 1 c. Back tracking d. Branch & Bound 0/1 5. Choose the correct answer for the following statements: I. The theory of NP–completeness provides a method of obtaining a polynomial time for NPalgorithms. II. All NP-complete problem are NP-Hard. a. I is FALSE and II is TRUE b. I is TRUE and II is FALSE c. Both are TRUE d. Both are FALSE 6. What is the type of the algorithm used in solving the 8 Queens problem? a. Greedy b. Dynamic c. Branch and Bound d. Backtracking 7. Sorting is not possible by using which of the following methods? a. Insertion b. Selection c. Deletion d. Exchange 8. 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) 9. The worst case time complexity of the nondeterministic dynamic knapsack algorithm is a. O(n log n) b. O( log n) c. O(n2) d. O(n) 10. Dijkastra’s algorithm bears some similarity to a. BFS b. prim’s algorithm c. DFS d. Both (A) & (C) 11. 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 amount of time c. It is the lower bound of the growth rate of algorithm d. Both A and B 12. There are ______steps to solve the problem a. Seven b. Four c. Six d. Two 13. ______is the first step in solving the problem a. Understanding the Problem b. Identify the Problem c. Evaluate the Solution d. None of these 14. _____ solution requires reasoning built on knowledge and experience a. Algorithmic Solution b. Heuristic Solution c. Random Solution d. None of these 15. 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 16. Straight selection sort is basically a method of repeated a. A. interchange b. searching c. position adjustment d. None of the above 17. Breadth first search __________ a. Scans each incident node along with its children. b. Scans all incident edges before moving to other node. c. Issame as backtracking d. Scans all the nodes in random order. 18. The asymptotic notation for defining the average time complexity is a. Equivalence b. Symmetric c. Reflexive d. Both (c) and (d) above. 19. Prims algorithm is based on _____________ method a. Divide and conquer method b. Dynamic programming c. Greedy method d. Branch and bound 20. __________ is the minimum number of steps that can executed for the given parameters a. Average case b. Worst case c. Time complexity d. Best case 21. __________ is the maximum number of steps that can executed for the given parameters a. Average case b. Worst case c. Time complexity d. Best case 22. __________ is the average number of steps that can executed for the given parameters a. Average case b. Worst case c. Time complexity d. Best case 23. Which design strategy stops theexecution when it find the solution otherwise starts the problem from top a. Back tracking b. Divide and conquer c. Branch and Bound d. Dynamic programming 24. Graphical representation of algorithm is _____________________ a. Pseudo-code b. Graph Coloring c. Flow Chart d. Dynamic programming 25. O(1) means computing time is __________________ a. Constant b. Quadratic c. Linear d. Cubic 26. O(n) means computing time is __________________ a. Constant b. Quadratic c. Linear d. Cubic 27. O(n2) means computing time is __________________ a. Constant b. Quadratic c. Linear d. Cubic 28. O(n3) means computing time is __________________ a. Exponential b. Quadratic c. Linear d. Cubic 29. O(2n) means computing time is __________________ a. Constant b. Quadratic c. Linear d. Exponential 30. Tight bound is denoted as _______ a. Ω b. Θ c. Ω d. O 31. Upper bound is denoted as _______ a. Ω b. Θ c. ω d. O 32. Lower bound is denoted as _______ a. Ω b. Θ c. ω d. O 33. The output of Kruskal and Prims algorithm is ________________ a. Maximum spanning tree b. Spanning tree c. Minimum spanning tree d. None of these 34. 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 35. Which of the following standard algorithms is not a Greedy algorithm? a. Dijkstra's shortest path algorithm b. Prim's algorithm c. Kruskal algorithm d. Huffman Coding e. Bellmen Ford Shortest path algorithm 36. Which is true statement. a. Breadth first search is shortest path algorithm that works on un-weighted graphs b. Depth first search is shortest path algorithm that works on un-weighted graphs. c. Both of above are true. d. None of above are true. 37. From the following algorithm design techniques which one is used to find all the pairs of shortest distances in a graph? a. Backtracking b. Greedy c. Dynamic programming d. Divide and Conquer 38. From the following sorting algorithms which has the lowest worst case complexity? a. Bubble sort b. Quick sort c. Merge sort d. Selection sort 39. An algorithm is defined as a. a mathematical formula that solves a problem. b. a tempo for classical music played in a coda. c. a logical sequence of a steps that solve a problem. d. a tool that designs computer programs and draws the user interface. 40. An algorithm that calls itself directly or indirectly is known as a. Sub algorithm b. Recursion c. Polish notation d. Traversal algorithm 41. If each node in a tree has value greater than every value in its left sub tree and value less than every value in its right sub tree, the tree is known as a. Complete Tree b. Full Binary Tree c. Binary Search Tree d. Threaded Tree 42. Which of the following sorting procedure is the slowest? a. Quick sort b. Heap sort c. Shell sort d. Bubble sort 43. A complete binary tree with the property that the value at each node is at least as large as the values at its children is known as a. Binary search tree b. AVL tree c. Completely balanced tree d. Heap 44. Which of the following shows the correct relationship among some of the more common computing times on algorithms a. O(log n) < O(n) < O( n* log n) < O(2n) < O(n2) b. O(n) < O(log n) < O( n* log n) < O(2n) < O(n2) c. O(n) < O(log n) < O( n* log n) < O(n2) < O(2n) d. O(log n) < O(n) < O( n* log n) < O(n2) < O(2n) 45. What is an optimal Huffman code for alphabeta of the following set of frequencies a: 05, b:48, c:07, d:17, e:10, f:13 a. 1010 b. (B)0101 c. 1001 d. 1100 46. Which of the following properties are necessary for an Algorithm? a. Definiteness b. Correctness c. Effectiveness d. A and C 47. The running time of Floyd-Warshall algorithm is a. ϴ (n) b. ϴ (n3) c. ϴ (n2) d. ϴ (n log n) 48. Kruskal’s algorithm uses-------- and prim’s algorithm uses------ in determining the MST a. edges,vertex b. vertex,edges c. edges,edges d. vertex,vertex 49. The time required to search an element in a linked list of length n is a. O(log n) b. O(n) c. O( 1) d. O(n2) 50. Which of the following is true a. P is subset of NP b. NP is subset of P c. P and NP are equal d. NP is subset of NP hard