Sham Daa MCQ

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Question A B C D Ans 1960 Bellman in_________ 1950 1953 1949 2 Dyanamic Programming invented by a U.S. Mathematician Richard optimization.

solving detecting None of the above 1 Dyanamic Programming is typically applied to ________problems topdown horizontal Bottom up. all of the above 3 Which approach Dyanamic programming uses for problem solving? matrix chain multiplication optimal binary search tress 0/1 knapsack problem all of the above. 4 which is the application of dyanamic programming? TRUE. FALSE 1 The Greedy strategy will not work for 0-1 Knapsack problem. Sorting Algorithm Prims Algorithm. Dijkstras algorithm None of the above 2 Specify the algorithms used for constructing Minimum cost spanning tree. Forest. is known as Region threaded tree None of the above 1 Collection of sub trees that are obtained when root node is eliminated Cubic. Quadratic nlogn logn 1 State time efficiency of OBST Quadratic. Cubic Square None of the above 1 State space efficiency of OBST Time and space requirement is high Optimality should be checked storage at isall needed levelsfor All all oflevel the above. 4 Which one of the following is drawback of dynamic programming? a set of feasible solution is generatedproblem and optimum is divided solution into is many small picked subproblems decision up. sequences None of are the genertrd above 1 In greedy methode all the vertices and circuit all the vertices of graph only G and few novertices circuit. and only circuit few vertices 2 and no vertices Spanning tree of graph G contains Linear problems Optimization problems Quadratic problems Bi-Quadratic problems 2 Algorithms based on Greedy technique are used for solving__________
nk 1) k +n1internal nodes n(k is 1) + 1. In a complete k-ary, every internal node has exactly k children. The number of leaves in such a(n tree with n (k 1) 3

O(| Ealgorithm |) +| V| logcan | V|). (| V | log | V using |) O ((| Ebinary | + | V |)log| 2 V |) structure with time complexity? (| V|2) Let G (V, E) an undirected graph with positive edge weights.O Dijkstras single source-shortes path be O implemented the heap data Queue Heap 3 To implement Dijkstras shortest path algorithm on unweighted graphs so that it runs in linearStack time, then data structure to be used is Tree non regular graph regular graph. complete graph 3 A graph in which all nodes are of equal degree is known as multigraph MST Knapsac Optimal storage onBoth tapesA and B.4 Which one of the following is an example of subset paradigm? Greedy Method Dynamic Programming.Divide and Conqure None of the above 2 Which method definitely gives an optimal solution? all level Last level all of the above 1 In dyanamic Programming Optimality should be checked at First Level. topdown. bottom up horizontal vertical 1 Greedy method uses_______approach. forward topdown backward A&C 4 The multistage Graph can be solved using ________approach. k>=2. where k>2 k<=2 k=2 1 In multistage graph all the vertices are partitioned into the k stages away,nearer nearer,away. the rootnearer away 2 In OBST,frequently used words are arranged ______ to the root and less frequently used words_____from encoding data. decoding data both A and b None of the above 1 Huffman algorithm is basically a coding technique for O(nlog n) O(log n). O(n) None of the above 2 What is the time complexity of huffman algorithm? decision stages. unrelated constraints policies 2 Dynamic programming divides problems into a number of conflicting objective functions state random variable node Transformation. 4 The relationship between stages of a dynamic programming problem is called a(n) implicit constraints both A & B None of the above 3 Which constraints backtracking uses to solve the problem? explicit constraints depth first search. breadth first search binary search all of the above 1 backtracking is a E-node None of the above 1 A node which is been generated and all whose children have live not node yet been generated is called dead node live nodefurther or all of whose children dead node. E-node None of the above 2 A __________node is a generated node which is not to be expanded have been generated live node dead node E-node. None of the above 3 The live node whose children are currently being expanded is called d+1. d-1 d+2 d*2 1 If the degree of given graph is d then we can color it with _____colors. Number of live node A least no of colors needed Number to color of dead the graph. node None of the above 2 What is the chromatic number? Stageto n-1. stage n+1 stage n itself stage n+2 2 In dynamic programming, the output to stage n become the input Greedy Method Backtracking. knapsac None of the above 2 What is the type of the algorithm used in solving the 8 Queens problem?

Backtracking is applicable to both types of problems: The optimization version calls for coloring a graph using the The 3-coloring problem is a special case of the

decision & optimization minimum number of paths coloring problem

solution and Decision and Solution optimization minimum number of roots K graph problem

minimum number of minimum colors. number 3 of nodes Graph coloring problem O(nk) k-coloring problem O(nkn) 4 2

backtracking algorithm for the k-coloring problem on a O(lognk) O(nk^n) graph with n vertices is Prims algorithm for minimum spanning Huffman tree algorithm Dijkstras algorithm is very similar to Which of the following algorithms solves the all-pair Dijkstras algorithm Warshall algorithm shortest path problem? O(m-n) O(m+n). For merging two sorted lists of sizes m and n into a sorted list of size m + n, we require comparisons of

Kruskals Algorithm Shortest path Algorithm 1 Floyd's algorithm Prims algorithm 3 O(log(m) + log(n))O(n) 2

Unrestricted use of goto is harmful, because it

makes debugging difficult.

increases the running time Results of programs in the compiler increases generating memory 1 longer requirement machineof code programs

Which of the following algorithm design technique is used in the quick sort algorithm?

Divide & conquer

Dynamic programming adjacent nodes O(n)

Greedy method neighbors O(n log n)

Backtracking 1 all of above. 4 4 O(n^2)

In a graph if e=[u, v], Then u and v are called endpoints of e What is the worst-case time for quicksort to sort an array of n elements? O(log n)

Suppose we are sorting an array of eight integers using quicksort, and we have just finished the first partitioning 1 with the array looking like this: 2 5 1 7 9 12 11 10 Which statement is correct? The pivot could be either the 7 or the The 9. pivot could be the The 7, but pivot it isis not not the the 9Neither 7, but itthe could 7 nor be the 9 is the pivot 3 What is the worst-case time for heapsort to sort an array of n O(log elements? n) O(n) O(n log n). O(n^2) Maximum number of nodes in a binary tree of depth K 2K-1. 2K 2K +1 None of these1 1 The technique of representing an aggregate data structure so zipper that it is convenient for writing programs that traverse the structure and update its contents, especially in purely function Vlist Jump List arbitrarily None of the above Which algorithm is used to find out the maximum flow fromFord-Fulkerson a source to a sink in a graph? algorithm Dijkstras algorithm Warshall algorithm None of these1 Consider the polynomial p(x) = a0 + a1x + a2x^2 +a3x^3, where ai != 0, for all i. The minimum number of multiplications needed to 1 2 3 evaluate p on 4 3 an input x is: 2 To implement Dijkstras shortest path algorithm on unweighted graphs so that it runs in linearQueue's time, the data structure to be used is: B Tree Stack Heap Which one of the following is a valid sequence of elements in array 3-ary max9, heap? 9, 5, 6, 8, 3, 1. 9, 5, 6, 8, 3, 1 3 1,an 3, 5, 6, 8,representing 9 6, 3, 1, 8, 5 2 In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using antheta(nLogn). O(n) time algorithm. What is the worst\theta(n^2 case timelog complexity of the quick sort? theta(n) \theta(n^2) n) Which of the following sorting algorithms has the lowest worst-case complexity? Bubble sort merge sort Quick sort Selection sort 2 4 In stable sorting algorithm One array is used In which duplicating elements More then are not onehandled arrays Duplicating are required elements remain in same relative position after sortin 2 In Quick sort algorithm,constants hidden in T(n lg n) are large Small medium None of the above 2 There is relationship between number of back edges and number cycles Both of are equal. in DFS There is no relationshipCycles between are back one edges fourth Cycles and of back number areedges. half of of cycle back edges. 2 You have an adjacency list for G, what is the time complexity to compute Graph transpose G^T ? VE (V+E) V E

1 What is the time complexity to extract a vertex from the priority queue in Prims algorithm? V LOG(V) E VE 3 paths. Dijkstras algorithm : Has greedy approach to find all shortest Haspaths. both greedy and Dynamic Has greedy approach approach toHas find toboth all compute shortest greedy single and source dynamic shortest approach paths to to compute all other single vertices source 1 What algorithm technique is used in the implementation of Kruskal for the MST? Greedy solution Technique. Divide-and-Conquer Technique Dynamic Programming The algorithm Technique combines more than one of the above techniques 3 of a graph, Which is true statement in the following. Kruskal algorithm is multiple sourceKruskals technique algorithm for finding is used MST Kruskal's to findalgorithm minimum None (choose spanning of the best tree above non-cycle edge) time is complexity better than of Prim's this algorithm (choose best is O 3 of a graph, Which is false statement in the following. Kruskal algorithm is multiple sourceKruskals technique algorithm for finding is used MST Kruskal's to findalgorithm minimum ALL (choose spanning best tree non-cycle edge) time is complexity better than of Prim's this algorithm (choose best is O 2one quarter of cycles The relationship between number of back edges and number Both of cycles in DFS is, are equal There is no relationshipBack between edges no. are of half edges Back ofand cycles edges cycles. are 1 Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best tree edge) when the graph has relatively few edges True . FALSE Suppose that a graph G = (V,E) is implemented using adjacency of a breadth-first traversal of G? O(|Vlists. | |E|).What is the complexity O(|V |^2|E|) O(|V |^2) O(|V | + |E|) 1 2 to find What is generally true of Adjacency List and Adjacency Matrix representations of than graphs? Lists require less space matrices Lists but take require longer more to space find Lists the than weight require matrices ofmore an and edge space they (v1,v2) take thanlonger matrices but are thefaster weight toof find an the edge weight (v1, v2). of an edge (v 2forward In digraph G=(V,E) ;G has cycle if and only if The DFS forest has forward edge. The DFS forest has back The edge DFS forest has BFS both forest back has and forward edge. edge. Back edge is: (u,v) where u is an ancesstor of v in the (u,v) tree where u is an ancesstor (u, v) of where v in the v is tree an ancestor of u 3 in the tree. 2 In Dynamic Programming 'Programming' means logic Planning code execution 1 The time efficiency and space efficiency of knapsack algorithm are (nW) . both in where W=capacity (n/W) (2nw) (nw) 1 traveling salesman and knapsack problems are example of NP-hard problems NP complete problem N hard problems N complete problem 1 traveling salesman is example of NP-hard problems NP complete problem N hard problems N complete problem 1 knapsack problems are example of NP-hard problems NP complete problem N hard problems N complete problem Elements of dynamic programming Optimal substructure Overlapping subproblems Memorization All of these. 4 2 This is not Elements of dynamic programming Optimal substructure Runtime -Execution Memorization Overlapping subproblems OBST is short form of obtimal binary search tree Optimal binary search tree optimal binary spanning obtimal tree binary2 spanning tree

You might also like