Sham Daa Mcq

2

Click here to load reader

description

This pdf contains MCQ Design and analysis of algorihm(DAA)

Transcript of Sham Daa Mcq

Page 1: Sham Daa Mcq

Question A B C D AnsDyanamic Programming invented by a U.S. Mathematician Richard Bellman in_________1960 1950 1953 1949 2

Dyanamic Programming is typically applied to ________problemsoptimization. solving detecting None of the above1

Which approach Dyanamic programming uses for problem solving?topdown horizontal Bottom up. all of the above3

which is the application of dyanamic programming? matrix chain multiplication optimal binary search tress0/1 knapsack problemall of the above.4

The Greedy strategy will not work for 0-1 Knapsack problem.TRUE. FALSE 1

Specify the algorithms used for constructing Minimum cost spanning tree.Sorting Algorithm Prim’s Algorithm. Dijkstra’s algorithmNone of the above2

Collection of sub trees that are obtained when root node is eliminated is known asForest. Region threaded tree None of the above1

State time efficiency of OBST Cubic. Quadratic nlogn logn 1

State space efficiency of OBST Quadratic. Cubic Square None of the above1

Which one of the following is drawback of dynamic programming?Time and space requirement is high Optimality should be checked at all levelsstorage is needed for all levelAll of the above.4

In greedy methode a set of feasible solution is generated and optimum solution is picked up.problem is divided into small subproblemsmany decision sequences are genertrdNone of the above1

Spanning tree of graph G contains all the vertices and circuit all the vertices of graph G and no circuit.only few vertices and circuitonly few vertices and no vertices2

Algorithms based on Greedy technique are used for solving__________Linear problems Optimization problems Quadratic problemsBi-Quadratic problems2

3

O (| V | log | V |) 2

To implement Dijkstra’s shortest path algorithm on unweighted graphs so that it runs in linear time, then data structure to be used isQueue Stack Heap Tree 3

A graph in which all nodes are of equal degree is known as multigraph non regular graph regular graph. complete graph3

Which one of the following is an example of subset paradigm?MST Knapsac Optimal storage on tapesBoth A and B.4

Which method definitely gives an optimal solution? Greedy Method Dynamic Programming.Divide and ConqureNone of the above2

In dyanamic Programming Optimality should be checked at First Level. all level Last level all of the above1

Greedy method uses_______approach. topdown. bottom up horizontal vertical 1

The multistage Graph can be solved using ________approach.forward topdown backward A & C 4

In multistage graph all the vertices are partitioned into the k stages wherek>=2. k>2 k<=2 k=2 1

In OBST,frequently used words are arranged ______ to the root and less frequently used words_____from the rootaway,nearer nearer,away. nearer away 2

Huffman algorithm is basically a coding technique for encoding data. decoding data both A and b None of the above1

What is the time complexity of huffman algorithm? O(nlog n) O(log n). O(n) None of the above2

Dynamic programming divides problems into a number of conflicting objective functions decision stages. unrelated constraintspolicies 2

The relationship between stages of a dynamic programming problem is called a(n)state random variable node Transformation.4

Which constraints backtracking uses to solve the problem? explicit constraints implicit constraints both A & B None of the above3

backtracking is a depth first search. breadth first search binary search all of the above1

A node which is been generated and all whose children have not yet been generated is calledlive node dead node E-node None of the above1

A __________node is a generated node which is not to be expanded further or all of whose children have been generatedlive node dead node. E-node None of the above2

The live node whose children are currently being expanded is calledlive node dead node E-node. None of the above3

If the degree of given graph is d then we can color it with _____colors.d+1. d-1 d+2 d*2 1

What is the chromatic number? Number of live node A least no of colors needed to color the graph.Number of dead nodeNone of the above2

In dynamic programming, the output to stage n become the input toStage n-1. stage n+1 stage n itself stage n+2 2

What is the type of the algorithm used in solving the 8 Queens problem?Greedy Method Backtracking. knapsac None of the above2

Backtracking is applicable to both types of problems: decision & optimization Decision and Solution 1

minimum number of paths minimum number of colors.minimum number of nodes3

The 3-coloring problem is a special case of the coloring problem K graph problem 4

O(lognk) O(nk^n) O(nk) O(nkn) 2

Dijkstra’s algorithm is very similar to Prim’s algorithm for minimum spanning treeHuffman algorithm Kruskals AlgorithmShortest path Algorithm1

Dijkstras algorithm Warshall algorithm Floyd's algorithm Prims algorithm3

For merging two sorted lists of sizes m and n into a sorted list of size m + n, we require comparisons ofO(m+n). O(log(m) + log(n))O(n) 2

Unrestricted use of goto is harmful, because it makes debugging difficult. increases the running time of programs increases memory requirement of programs1

Greedy method Backtracking 1

In a graph if e=[u, v], Then u and v are called endpoints of e adjacent nodes neighbors all of above. 4

What is the worst-case time for quicksort to sort an array of n elements?O(log n) O(n log n) 4

The pivot could be either the 7 or the 9. The pivot is not the 7, but it could be the 9

1

What is the worst-case time for heapsort to sort an array of n elements? O(n) O(n log n). O(n^2) 3

Maximum number of nodes in a binary tree of depth K 2K-1. 2K 2K +1 None of these1

The technique of representing an aggregate data structure so that it is convenient for writing programs that traverse the structure arbitrarily and update its contents, especially in purely functional programming languages is known as zipper Vlist None of the above1

Which algorithm is used to find out the maximum flow from a source to a sink in a graph?Ford-Fulkerson algorithm Warshall algorithm 1

Consider the polynomial p(x) = a0 + a1x + a2x^2 +a3x^3, where ai != 0, for all i. The minimum number of multiplications needed to evaluate p on an input x is:1 2 3 4 3

To implement Dijkstra’s shortest path algorithm on unweighted graphs so that it runs in linear time, the data structure to be used is:Queue's Heap B Tree 2

Which one of the following is a valid sequence of elements in an array representing 3-ary max heap?1, 3, 5, 6, 8, 9 9, 6, 3, 1, 8, 5 9, 5, 6, 8, 3, 1 3

In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using an O(n) time algorithm. What is the worst case time complexity of the quick sort?theta(n) theta(nLogn). \theta(n^2) \theta(n^2 log n)2

Which of the following sorting algorithms has the lowest worst-case complexity?Bubble sort Quick sort Selection sort 2

In stable sorting algorithm One array is used In which duplicating elements are not handledMore then one arrays are required4

In Quick sort algorithm,constants hidden in T(n lg n) are large Small medium None of the above2

There is relationship between number of back edges and number of cycles in DFSBoth are equal. Cycles are one fourth of back edges.2

VE (V+E) V E 2

In a complete k-ary, every internal node has exactly k children. The number of leaves in such a tree with n internal nodes is n k (n — 1) k + 1 n(k — 1) + 1. n (k — 1)

Let G (V, E) an undirected graph with positive edge weights. Dijkstra’s single source-shortes path algorithm can be implemented using the binary heap data structure with time complexity?O(| V|2) O(| E |) +| V| log | V|). O ((| E | + | V |)log| V |)

solution and optimization

The optimization version calls for coloring a graph using the

minimum number of roots

Graph coloring problem

k-coloring problem

backtracking algorithm for the k-coloring problem on a graph with n vertices is

Which of the following algorithms solves the all-pair shortest path problem?

O(m-n)

Results in the compiler generating longer machine code

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

Divide & conquer Dynamic programming

O(n) O(n^2)

Suppose we are sorting an array of eight integers using quicksort, and we have just finished the first partitioning with the array looking like this:2 5 1 7 9 12 11 10Which statement is correct? The pivot could be the 7, but it is not the 9 Neither the 7 nor the 9 is the pivot

O(log n)

Jump List

Dijkstras algorithm None of these

Stack

9, 5, 6, 8, 3, 1.

merge sort

Duplicating elements remain in same relative position after sorting.

There is no relationship between back edges and number of cycle Cycles are half of back edges.

You have an adjacency list for G, what is the time complexity to compute Graph transpose G^T ?

Page 2: Sham Daa Mcq

LOG(V) V E VE 1

Dijkstra’s algorithm : Has greedy approach to find all shortest paths.Has both greedy and Dynamic approach to find all shortest paths.Has both greedy and dynamic approach to compute single source shortest paths to all other vertices.3

Divide-and-Conquer TechniqueDynamic Programming TechniqueThe algorithm combines more than one of the above techniques1

Which is true statement in the following. Kruskal algorithm is multiple source technique for finding MSTKruskals algorithm is used to find minimum spanning tree of a graph, time complexity of this algorithm is O(EV)None of the above3

Which is false statement in the following. Kruskal algorithm is multiple source technique for finding MSTKruskals algorithm is used to find minimum spanning tree of a graph, time complexity of this algorithm is O(EV)ALL 3

The relationship between number of back edges and number of cycles in DFS is,Both are equal Back edges are half of cyclesBack edges are one quarter of cycles2

FALSE 1

Suppose that a graph G = (V,E) is implemented using adjacency lists. What is the complexity of a breadth-first traversal of G?O(|V |^2|E|) O(|V |^2) O(|V | + |E|) 1

Lists require less space than matrices but take longer to find the weight of an edge (v1,v2)Lists require more space than matrices and they take longer to find the weight of an edge (v1, v2).Lists require more space than matrices but are faster to find the weight of an edge (v1, v2)2

In digraph G=(V,E) ;G has cycle if and only if 2

Back edge is: (u,v) where u is an ancesstor of v in the tree(u,v) where u is an ancesstor of v in the tree 3

In Dynamic Programming 'Programming' meansIn Dynamic Programming 'Programming' means logic Planning code execution 2

The time efficiency and space efficiency of knapsack algorithm are both in where W=capacity The time efficiency and space efficiency of knapsack algorithm are both in where W=capacity θ(n/W) 1

traveling salesman and knapsack problems are example of NP-hard problems NP complete problem N hard problems N complete problem1

traveling salesman is example of NP-hard problems NP complete problem N hard problems N complete problem1

knapsack problems are example of NP-hard problems NP complete problem N hard problems N complete problem1

Elements of dynamic programming Optimal substructure Overlapping subproblemsMemorization All of these. 4

This is not Elements of dynamic programming Optimal substructure Runtime -Execution Memorization Overlapping subproblems2

OBST is short form of obtimal binary search tree Optimal binary search treeoptimal binary spanning treeobtimal binary spanning tree2

What is the time complexity to extract a vertex from the priority queue in Prim’s algorithm?Has greedy approach to compute single source shortest paths to all other vertices

What algorithm technique is used in the implementation of Kruskal solution for the MST?Greedy Technique.

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

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

There is no relationship between no. of edges and cycles.

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

O(|V | |E|).

What is generally true of Adjacency List and Adjacency Matrix representations of graphs?The DFS forest has forward edge. The DFS forest has back edgeThe DFS forest has both back and forward edge.BFS forest has forward edge.

(u, v) where v is an ancestor of u in the tree.

θθ(nW)(nW).. θθ(2nw)(2nw) θθ(nw)(nw)