0% found this document useful (0 votes)
35 views16 pages

DAA Hand Book

Notes

Uploaded by

dask84779
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
35 views16 pages

DAA Hand Book

Notes

Uploaded by

dask84779
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 16
UNIT WISE OBJECTIVE QUESTIONS UNIT- 1.In analysis of algorithm, approximate relationship between the size of the job and the amount of work required to do is expressed by using (a) Central tendency (b) Differential equation (c) Order of execution (d) Order of magnitude (¢) Order of Storage. Ans :Order of execution 2. Worst case efficiency of binary search is, (a) log2 n+ 1 (b)a (N2 (@)2n (e) log n. Ans: log? n +1 3. For defining the best time complexity, let f (n) = log n and g (n) = Vn, (af (a) DA(g(n)), but e(n) OQ (A{n)) (b) F(n) DO(e(m)), but s(n) OO (Aa) (of (a) DO(E(n)), and g(n) O © (fin)) (d) F(n) DO(g(n)), and g(n) 0 2 (f{n)) Ans :f (n) 0.2(g(n)), but g(n) 0 2 (f(n)) 4. For analyzing an algorithm, which is better computing time? (a)O (100 Log N) (b) 0 (N) (c)O (2N) (4) O(N log) (c) 0 (N2). Ans :O (100 Log N) 5. Let f, t: NR 1 0, and t (n) CO (F(n)) iff t(n)<¢ £(n) where cis positive real constant andn= no, then no is (a) Upper bound (b)Lower bound (c) Duality value (@) Threshold value (e) Maximum value. Ans :Lower bound16. Consider the usual algorithm for determining whether 6. Consider the usual algorithm for determining whether a sequence of parentheses is balanced. What is the maximum number of parentheses that will appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()()\(0)) (a) 12 ©)3 @)4 Ans :3 7. Breadth first search (a) Scans each incident node along with its children, (b) Scans all incident edges before moving to other node. (©) Issame as backtracking (@) Scans all the nodes in random order. Ans :Scans all incident edges before moving to other node. 8. Which method of traversal does not use stack to hold nodes that are waiting to be processed? (a) Dept First (b) D-search (c)Breadth first (@) Back-tracking Ans :Breadth first GNITC(Autonomous) - R18 - II Year II Sem — Student Hand Book | 94 Scanned with CamScanner 9. The Knapsack problem where the objective function is to minimize the profit is (a) Greedy (b) Dynamic 0/ 1 (¢) Back tracking (a) Branch & Bound 0/1 Ans :Branch & Bound 0/1 10. Choose the correct answer for the following statements: I. The theory of NP-completeness provides a method of obtaining a polynomial time for NPalgorithms. IL All NP-complete problem are NP-Hiard. (@) lis FALSE and I is TRUE (b) I is TRUE and I is FALSE (©) Both are TRUE (d) Both are FALSE ‘Ans :Tis FALSE and I is TRUE 11. Ifall c(i, j)’s and r(i, j)’s are calculated, then OBST algorithm in worst case takes one of the following time. (a) O(a log n) (b) O(03) (c) O(n2) (@) Ollog n) (e) O(n4). Ans : O(n3) 12. For a 15-puzzle problem let the initial arrangement be the following one, then answer the questions 4 ~ 7 with the following arrangement. 1013 157 91414 1286 11253 ‘What is the value of “x’ used to find the reachability of the solution? (a) 1 (b) 0 (c) 8 (@) 10 (e) 13. Ans: 1 13. The upper bound on the time complexity of the nondeterministic sorting algorithm is (a) O(n) (b) O(n log n) (c) OC) (4) OC log n) (€) O(n?) Ans: O(n) 14, The worst case time complexity of the nondeterministic dynamic knapsack algorithm is (a) O(a Jog n) (b) O( og n) (€) O(n2) (4) O(a) (e) O). Ans :O(n) 15, Recursive algorithms are based on (a) Divideand conquer approach (b) Top-down approach (©) Bottom-up approach (d) Hierarchical approach (e) Heuristic approach. Ans :Bottom-up approach 16. What do you call the selected keys in the quick sort method? (a) Outer key (b)Inner Key (c) Partition key(d) Pivot key (e) Recombine key. Ans ze 17. How do you determine the cost of a spanning tree? (a) By the sum of the costs of the edges of the tree GNITC(Autonomous) - R18 - II Year II Sem — Student Hand Book | 95 Scanned with CamScanner (b) By the sum of the costs of the edges and vertices of the tree (©) By the sum of the costs of the vertices of the tree (a) By the sum of the costs of the edges of the graph () By the sum of thecosts of the edges and vertices of the graph. Ans :By the sum of the costs of the edges of the tree8. 18. The time complexity of the normal quick sort, randomized quick sort algorithms in the worst case is (a) O(n2), O(n log n) (b) O(n2), O(n2) (€) O(n Hog n), O(n2) (A) O(n log n), O(n log n) (e) O(n log n), O(n? log n). Ans :O(n2), O(n2) 19. Let there be an array of length ‘N’, and the selection sort algorithm is used to sort it, how many times a swap function is called to complete the execution? (a) N log N times (b) log N times (c) N2 times (a) N-1 times (e) N times. ‘Ans :N-1 times 20. The Sorting methodwhich is used for external sort is (a) Bubble sort (b) Quick sort (c) Merge sort (@) Radix sort (e) Selection sort, Ans :Radix sort 21. The Hamiltonian cycles problem uses the following line of code to generate a next vertex, provided x[ | is a global array and kth vertex is under consideration: (a) xfk] O (x{k] + 1) mod n (b) xf] 0 (x[k}) mod (n) (©) xEk] Ol (XtK] + 1) mod (+1) (4) xIK] C xfk+1] mod n Ans :x{k] 0 (x{k] + 1) mod (n+1) 22. The graph colouringalgorithm’s time can be bounded by (a) OGmam) (b) Ofam) (©) Ofam. 2n) (d) Ofamn). Ans :O(amn). 23. For 0/1 KNAPSACK problem, the algorithm takes amount of time formemory table, and time to determine the optimal load, for N objects and ‘Was the capacity of KNAPSACK. (a) O(N+W), O(NW) (b) TENW),O(N+W) (C)0(N),O(NW) (@) OCNW),0(N) Ans :(b) C(NW),O(N+W) 24, Sorting is not possible by using which of the following methods? (a) Insertion (b) Selection (c) Deletion (d) Exchange ‘Ans :Deletion 25. What is the type of the algorithm used in solving the 8 Queens problem? (a)Backtracking (b) Dynamic (c) Branch and Bound (4) DandC Ans :Backtracking 26. The following are the statements regarding the NP problems. Chose the right option from the following options: 1 All NP-complete problems are not NP-hard. Il. SomeNP-hard problems are not known to be NP-complete. (a) Both (1) and (I) are true GNITC(Autonomous) - R18 - II Year II Sem — Student Hand Book| 96 Scanned with CamScanner (b) Both (D) and (I) are false (c) Only (1) is true (a) Only (ID is true Ans :Only (II) is true 27. Let G be a graph with ‘n’ nodes and let ‘m’ be the chromatic number of the graph. ‘Then the time taken by the backtracking algorithm to color itis (a) O(am) (b) O(n+m) (c) O(mnm) (4) O(amn). Ans :O(nmn). 28, The time complexity of the shortest path algorithm can be bounded by (a) O(n2 (b) O(n4) (c) O(n3) (a) 0@) (c) O(n log n). Ans :0(n3) 29. Read the following statements carefully and pick the correct option: I The worst time complexity of the Floyd’s algorithm is O(n3). I. ‘The worst time complexity of the Warshall’s algorithm is O(n3) (a) (D is false but (II) is true (b) (Dis true but (11) is false () Both (1) and (I1) are true (a) (D is true and (II) is not true always (e) Both (1) and (11) are false. ‘Ans :Both (1) and (II) are true 30. Theasymptotic notation for defining the average time complexity is (a) Equivalence (b) Symmetric () Reflexive (e) Both (c) and (4) above. ‘Ans Equivalence 31. 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) (n) worst case: O(n*log(n)) n*log(n)) worst case: O(n*log(n)) (a) best case: O(n*log(n)) worst case: O(n*n) ‘Ans : best case: O(n) worst case: O(n*n) 32. 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) (n) worst case: O(n*log(n)) : Olai*log(n)) worst case: O(n*log(a)) GNITC(Autonomous) - R18 - II Year II Sem — Student Hand Book | 97 Scanned with CamScanner (d) best case: O(n*log(n)) worst case: O(n*n) Ans :best case: O(n*log(n)) worst case: O(n*n) 33. 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) (0M) (d) O(K) Ans : O(N) 34, Which of the following belongs to the algorithm paradigm? (a) Minimum & Maximum problem (b) Knapsack problem (©) Selection problem (a) Merge sort (©) Quick sort. Ans : Knapsack problem 35. If fit: N> R+, then t (n) 0 © (£ (n)), iff f{n) CO (t (a) is known as (a) Limit rule (b) Rule of inference (©) Duality rule (a) Rule of consequences 36. The time taken by NP-class sorting algorithm is, (a) Od) (b) O(log n) (c) O(n2) (@ Om) Ans :O(n) 37. Find the odd one out from the following categories of algorithms (a) TVSP (b) N-Queens (©) 15-Puzzle (4) Bin-Packing. Ans : Bin-Packing. 38. The time complexity of binary search in best, worst cases for an array of size N is (a) N, N2 (b) 1, LogN (©) Log N, N2 (4) 1, NlogN Ans : 1, LogN 39. Which of following algorithm scans the list by swapping the entries whenever pair of adjacent keys are out of desired order? (a) Insertion sort (b) Quick sort (©) Shell sort GNITC(Autonomous) - R18 - It Year II Sem ~ Student Hand Book | 98 Scanned with CamScanner (4) Bubble sort Ans : Bubble sort 40. The mathematical definition for Omega can be defined as, provided f,g:NOR+ and c is a positive constant and n > n0, (a) fin) > c. gn) n (b) fim) =¢. g(a) n (o)fin) > + a(n) n (d) f(n) = ¢ + g(n) UNIT-I 1. Name the node which has been generated but none of its children nodes have been generated in state space tree of backtracking method. (a) Dead node (b) Live node (©) E-Node (d) State Node Ans: Livenode 2. How many nodes are there in a full state space tree with n= 6? (a) 65 (b) 64 (0) 63 (a) 32 Ans : 63 3. This algorithm scans the list by swapping the entries whenever pair of adjacent keys are out of desired order. (a) Insertion sort (b) Bubble sort (©) Shell sort. (@) Quick sort. Ans: Bubble sort. 4, The C) notation is (a) Symmetric (b) Reflexive (c) Transitive (@) B &C only Ans: Transitive 5, From the following chose 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. (©) Selection problem. (d) Merge sort. GNITC(Autonomous) - R18 - II Year II Sem — Student Hand Book | 99 Scanned with CamScanner Ans: Knapsack problem. 6 To calculatec(i,j )’s, w( i, j)’s and r(i,j)’s; the OBST algorithm in worst case takes the following time. (a) Odog n) (b) O (a4) (6) 0 (03) (d) 0 (a log n) ‘Ans: 0 (n3) 7. What is the type of the algorithm used in solving the 4 Queens problem? (a) Greedy (b) Dynamic (c) Branch and Bound (d) Backtracking. Ans: Backtracking. 8.ln Knapsack problem, the best strategy to get the optimal solution, where Pi, Wi is the Profit, Weight associated with each of the Xi th 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 (a) Arrange the values Pi/Xi in descending order Ans: Arrange the values Pi/Xi in descending order 9.Greedy job scheduling with deadtines algorithms” complexity is defined as (a) OW) (b) Q( n tog n) (©) 0 @2 log n) (d) O(n log n) Ans: O(N) 10.The divide and conquer merge sort algorithm’s time complexity can be defined as (a) 0 Cong n) (b) 0 @) (c)Q(nlogn) (a) G (log n) Ans: 1 (n log n) 11. The 0 notation is (a) Symmetric (b) Reflexive (©) Transitive (4) (a), (b) and (c) above. Ans : (a), (b) and (¢) above. 12 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 GNITC(Autonomous) - R18 - It Year II Sem ~ Student Hand Book | 100 Scanned with CamScanner (b) Knapsack problem (©) Selection problem (a) Merge sort Ans : Knapsack problem 13 Pick the correct statement(s) from the following set of statements. IL In Prim’s algorithm, for the construction of minimal spanning tree for a graph, the selected edges always form an orchard. IML DES, BES algorithms always make use of a queue, and stack respe (a) Only (1) above (b) Only (11) above (c) Only (IIT) above (a) Both (1) and (IM) above Ans : Only (1) above 14, Identify the name of the sorting in which tis (a) Selection sort (b) Bubble sort (©) Queik sort (d) Insertion sort. Ans : Insertion sort 15. The optimal solution to a problem is a combination of optimal solutions to its subproblems. ‘This is known as (a) Principleof Duality (b) Principle of Feasibility (c) Principle of Optimality (d) Principle of Dynamicity. ‘Ans : Principle of Optimality 16. Which of the following versions of merge sort algorithm does uses space efficiently? (a) Contiguous version (b) Array version (c) Linked version (@) Structure version (e) Heap version. Ans: Linked version 17. 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 I In the Kruskal’s algorithm, for the construction of minimal spanning tree for a graph, the selected edges always form a forest.Ans : Resource allocation problem 18, How many edges are there in a Hamiltonian cycle if the edge cost is ‘c’ and the cost of cycle is ‘en’ ly. is not proportional to n2, GNITC(Autonomous) — R18 - Il Year II Sem — Student Hand Book | 101 Scanned with CamScanner (aye (b) en (on (d) 2c ‘Ans :n. 19. A problem L is NP-complete iff L is NP-hard and (a) L=NP (b) LaNP (c) LeNP (d) L=NP Ans: Le NP 20. What would be the cost value for any answering node of a sub tree with root ‘r” using branch-bound algorithm? (a) Maximum (b) Minimum (©) Optimal (@) Average Ans: Minimum 21. In analysis of algorithm, approximate relationship between the size of the job and the amount of work required to do itis expressed by using (a) Order of magnitude or Big - O (b) Central tendency (©) Differential equation (4) Polynomial equation Ans: Order of magnitude or Big -O 22. Worst case efficiency of binary search is (a) log2 n+ 1 ()n ()N2 @2 n ‘Ans: log? n+ 1 23. Worst case efficiency of which search is O(n)? (a) Sequential search (b) Binary search (©) Indexed search (a) Hashing Ans: Sequential search 24, Breadth first search (a) Scans all incident edges before moving to other vertex (b) Scans adjacentunvisited vertex as soon as possible (c) Is same as backtracking (a) Computes a path between two vertices of graph or equivalently Ans: Scans all incident edges before moving to other vertex 25. Which of the following searching methods requires that all keys must reside GNITC(Autonomous) - R18 - Year II Sem ~ Student Hand Book | 102 Scanned with CamScanner in internal memory? (a) Binary search (b) Sequential search (©) Hashing (@) Depth first search Ans: Binary search 26. Which of the following formulas in Omega notation best represent the expressionn®s35n+6? (a) & (nm) (b) Q (n*) (©) 2 (n) (A) 2.35) Ans: © (n*) 27. What term is used to describe an O(n) algorithm? (a) Constant (b) Non Polynomial Deterministic (©) Logarithmic (4) Linear. Ans: Linear. 28, Express the formula (n - 2y*(n - 4) using @ notation: (a) 8 (n2) (b) 8 (8) (c) 9 (log n) (4) @(n) Ans: 0 (n2) 29, Read the following statements carefully and pick the right most option. 1. A linear algorithm to solve a problem must perform faster than a quadratic algorithm to solve the same problem. IL. An algorithm with worst case time behavior of 3n takes at least 30 operations for every input of size n=10. (a) Both (1) and (1) are TRUE (b) Both (1) and (11) are FALSE (©) @) is TRUE but (11) is FALSE (c) () is FALSE and (I) is TRUE. Ans: (1) is TRUE but (11) is FALSE 30. Which of the following are essential statement types for describing algorithms? (a) Sequence (b) Selection (c) Repetition (d) All the above ‘Ans: All the above 31. When we say an algorithm has a time complexity of © (n), what does it mean? (a) The algorithm has ‘n’ nested loops (b) The computation time taken by the algorithm is proportional to n (c) The algorithm is ‘n’ times slower than a standard algorithm (d) There are ‘n’ number of statements in the algorithm Ans: The computation time taken by the algorithm is proportional to n 32. Can we read a data item at any location of a list within a constant time (ie. oa)? (a) Yes (b) Yes, only if the list is implemented by pointers (i.e. linked-list) (©) Yes, only if the list is implemented by an array (a) No, we need O(n) computation steps no matter what kind of implementation is used Ans: Yes, only if the list is implemented by an array 33, Sequential search has a time complexity of O(n), and binary search has a time GNITC(Autonomous) - R18 - It Year II Sem ~ Student Hand Book | 103 Scanned with CamScanner complexity of O(log(n)). What difference will it make when the size n is 1000? (a) You would not notice much difference because computers run very fast anyway (b) As n is 1000, binary search is twice as fast as sequential search (©) As nis 1000, binary search is 10 times as fast as sequential search (@) As nis 1000, binary search is 100 times as fast as sequential search. Ans: As n is 1000, binary search is 100 times as fast as sequential search. 34. Readthe following statements carefully, and choose the correct answer. 1 The Q notation is Anti Symmetric. IL. The big Oh notation is Semi Equivalence. (a) (Dis FALSE but (I) is TRUE (b) Both (1), (I) are TRUE (©) () is TRUE but( If) is FALSE (4) Both (1, (Il) are FALSE, Ans: Both (1), (11) are TRUE, 35. Find the odd one out (a) Merge Sort (by VSP Problem (c) KnapSack Problem(d) OBST Problem ‘Ans:Merge Sort 36. 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) 11) 2NCN (4) 2NCN ‘Ans: one 37. The mathematical definition for Omega can be defined as, provided f,g:NOR+ and ¢ is a positive constant and n> n0, (a) ffm)z e. g(n) n (b) f(a) £ c. gin) n (c)fin) > e+ p(n) n (@) f(a) £c + g(a)n (6) f(a) £ g(n) n Ans:f(n)> c. g(n) n 38. The OBST algorithm in worst case takes time if all e(i,j 's and r(i, j)’s are calculated. (a) Oddog n) (b) O(n4) (c) O(3) (A) O(n og n) Ans: O(n3) 39. The LI notation is I. Symmetric. IL Reflexive. IIL Transitive. (a) Only (0) above (b) Only (ID above (c) Only (II) above (A) All @, (I) and (IMP) above. Ans:All (D,(ID) and (IM) above. 40. Breadth first search uses as an auxiliary structure to hold nodes for future processing. GNITC(Autonomous) - R18 - Year II Sem ~ Student Hand Book | 104 Scanned with CamScanner (a) Stack (b) Linked list (c) Graph (4) Queue. Ans : Queue UNIT 81. From the following pick the one which does not belongs to the same paradigm to which others belongs to. (a) Minimum & Maximum problem (b) Knapsack problem (©) Selection problem (@) Merge sort Ans:Knapsack problem 82. Primsalgorithm is based on method a. Divide and conquer method ¢. Dynamic programming b. Greedy method d. Branch and bound ‘Ans. Greedy Method 83. The amount of memory needs to run to completion is known as a. Space complexity c. Worst case b. Time complexity d. Best case ‘Ans: Space complexity 84. The amount of time needs to run to completion is known as a. Space complexity c. Worst case b. Time complexity d. Best case Ans: Time complexity 85. is the minimum number of steps that can executed for the given parameters a. Average case c. Worst case b, Time complexity d. Best case ‘Ans: Best case 86. is the maximum number of steps that can executed for the given parameters a. Average case c. Worst case b. Time complexity d. Best case Ans: Worst case 87. is the average number of steps that can executed for the given parameters a. Average case c. Worst case b. Time complexity d. Best case Ans: Average Case 88. Testing of a program consists of 2 phases which are and a. Average case & Worst case b. Time complexity & Space complexity c. Validation and checking errors d. Debugging and profiling GNITC(Autonomous) - R18 - Year II Sem ~ Student Hand Book | 105 Scanned with CamScanner Ans: Debugging and profiling 89. Worst case time complexity of binary search is a. O(n) b. O(logn)e. @(nlogn) d. @(logn) Ans: @(logn) 90. Best case time complexity of binary search is a. O(n) ¢. O(nlogn) b. O(logn) d. O(logn) Ans: O(logn) 91. Average case time complexity of binary search is a. O(n) . O(nlogn) b. O(logn) d. O(logn) Ans: O(logn) 92. Merge sort invented by a. CARHOARE c. HAMILTON b. JOHN VON NEUMANN d. STRASSEN ‘Ans : JOHN VON NEUMANN 93. Quick sort invented by a. CARHOARE c. HAMILTON b. JOHN VON NEUMANN d. STRASSEN ‘Ans : CARHOARE 94. Worst case time complexity of Quick sort is a. O(n2log7) c. O(alogn) b, O(n2) d. Oogn) Ans : O(n2) 95, Best case time complexity of Quick sort is a. O(n2logn) c. O(alogn) b. O(logn) d. Ologn2) Ans : O(alogn) 96. Average case time complexity of Quick sort is a, 6 (nlogn) b. O(logn)c. O(nlogn) d. O(logn) Ans : O(nlogn) 97. Which design strategy stops theexecution when it find the solution otherwise starts the problem from top a. Back tracking c. Divide and conquer b. Branch and Bound d. Dynamic programming ‘Ans: Back Tracking 98, Graphical representation of algorithm is a. Pseudo-code c. Graph Coloring , Flow Chart d. Dynamic programming ‘Ans: Flow Chart 99. In pseudo-code conventions input express as a. input c. Read b. Write d. Return Ans : Write GNITC(Autonomous) - R18 - Year II Sem — Student Hand Book | 106 Scanned with CamScanner 100. In pseudo-code conventions output express as, a. input c. Read b. Write d, Return Ans : Read 101. Performance based criteria of algorithm , which has to do with its computing time is a. Time Complexity c. Input b. Space Complexity d. Finiteness Ans : Time Complexity 102. Performance based criteria of algorithm , which has to do with its storage requirements is a. Time Complexity e. Input b. Space Complexity d. FinitenessAns :Space Complexity 103. O(1) means computing time is a. Constant ¢. Quadratic b. Linear d. Cubic Ans : Constant 104. O(n) means computing time is a. Constant ¢. Quadratic b. Linear d. Cubic ‘Ans: Linear 105. O(n2) means computing time is a. Constant ¢. Quadratic b. Linear d. Cubic Ans : Quadratic 106. O(n3) means computing time is a. Exponential c. Quadratic b. Linear d. Cubic Ans :Cubie 107. O2n) means computing time is a. Constant c. Quadratic . Linear d. Exponential ‘Ans : Exponential 108. Application of quicksort a. Graphie card ¢. Data Processing b. Tape sorting d. Card Sorting Ans : Graphic card 109. Application of mergesort a, Graphic card b. Networkinge. Card Sorting d. Data Processing Ans : Data Processing 110. ‘The method will choosing when sub problems share sub problems a. Divideand conquer e. Greedy method b, Dynamic programming d. Back tracking GNITC(Autonomous) - R18 - I Year II Sem ~ Student Hand Book | 107 Scanned with CamScanner Ans : Dynamic programming IIL. Time complexity of given algorithm Algorithm Display (A) { For [:=0 to n-1 { For J:=0 ton-1 { Write A; ) ) } a, 2n2+4ni4 c, 2n2+n bb, 2n244m42 d. 22-1 Ans : 2n244n42 112. The sorting , which works very well for small file is a. Count sort c. Selection sort b. Merge sort d. Quick sort Ans: Selection sort 113, Merge sort is . a. Externalsorting c. Insertion sorting b. Internal sorting d. Exponential sorting Ans : External sorting 14, is a step-by-step procedure for calculationsa. Program c. Algorithm b. Greedy Method d. Problem Ans: Algorithm 115. Advantage of finding maximum and minimum using divide and conquer method instead of using conditional operators is a. Reduce Space complexity c. Get accurate value b, Reduce Time complexity d. Simple calculations Ans :Reduce Time complexity 116. Given two non-negative functions f(a)= 5n2+6n+1 and g(n)=n2 . Calculate upper bound value ,C a.C=Sc. C=12 b.C=6d.C=11 value ,C 118, The functions f &g are non-negative functions, The function f(n)=Og(n)) if and only if there exist positive constants e& n0 such that for all n, n> n0 GNITC(Autonomous) - R18 - I Year II Sem ~ Student Hand Book | 108 Scanned with CamScanner a. f(n) Cg(n) d. f(n) I= C*g(n) Ans: f(n)< C*g(n) 119. The functions f & g are non-negative functions. The function f{n)=Q(g(n)) if and only if there exist positive constants e& n0 such that for all n, n> n0 a. f(a) < Can) c. fla) = C*e(n) b. fin) > C#g(n) d. fn) I= C¥g(n) Ans: f(n)> C#g(n) 120, The functions f & g are non-negative functions. The funetion f(n)=8(g(n)) if'and only if there exist positive constants ¢1,c2 & n0 such that for all n, n> n0 a. C2*g(n)< f(n) < Cl *g(n) c. C2*g(n)> f(n) = C1*g(n) b. C2 p(n)I= fin) = C1¥g(n) d. C2*g(n)s fn) = C1*g(n) Ans :C2*g(n)s f(n) < C1*g(n) UNIT-IV 121, Tight bound is denoted as. ade bado Ans: @ 122. Upper bound is denoted as ade® bado Ans: 0 123. lower bound is denoted as aQcO bodo Ans :Q 124, The function f(n)=0(g(n)) if and only if Limit f(n)/g(n)=0n->00 a. Little oh b. Little omega b. Big oh d. Omega Ans : Little oh 125, The functionf(n)=o((n)) if and only if Limit g(ny/f(n)=0 n->o0 a. Little oh b. Little omega b. Big oh d. Omega Ans : Little omega 126. Thegeneralcriteriaof algorithm;zero or more quantities are externally supplied is a. Output b. Finiteness b. Effectiveness d. Input ‘Ans: Input 127. The general criteria of algorithm; at least one quantity is produced a. Output b. Finiteness GNITC(Autonomous) - R18 - Year II Sem ~ Student Hand Book | 109 Scanned with CamScanner

You might also like