751 views

Uploaded by Sami Signs

- Chess as Graph Theory
- Cs502 Collection of Old Papers
- Algo Mcq Compiled
- CS604 Quizzes Solved
- Greedy And DFS In Huffman Coding
- Cs614 Collection of Old Papers
- CS502_all
- Algorithm Question Set
- Dijkstra’s Algorithm Shortest Path
- Ete
- GraphTheory
- Spanning Trees
- Chapter8 Deadlocks
- Comb Sorting
- Tree Data Structure
- Leamer%20M.J.%20Groebner%20finite%20path%20algebras%20(M.S.%.pdf
- Merge Sort
- Insertion Sort Bubble Sort Selection Sort
- MST.ppt_0
- 3-floyd

You are on page 1of 116

want to find, Not a solution An algorithm Good solution The best solution Question No: 2 ( Marks: 1 ) - Please choose one Although it requires more complicated data structures, Prim's algorithm for a minimum spanning tree is better than Kruskal's when the graph has a large number of vertices. True False Question No: 3 True False unknown Question No: 4 ( Marks: 1 ) - Please choose one What is generally true of Adjacency List and Adjacency Matrix representations of graphs? Lists require less space than matrices but take longer to find the weight of an edge (v1,v2) Lists require less space than matrices and they are faster 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) Question No: 5 ( Marks: 1 ) - Please choose one If a graph has v vertices and e edges then to obtain a spanning tree we have to delete v edges. v e + 5 edges v + e edges. None of these Question No: 6 ( Marks: 1 ) - Please choose one Maximum number of vertices in a Directed Graph may be |V2| True False ( Marks: 1 ) - Please choose one

If a problem is in NP, it must also be in P.

Question No: 7 ( Marks: 1 ) - Please choose one The Huffman algorithm finds a (n) _____________ solution. Optimal Non-optimal Exponential Polynomial Question No: 8 ( Marks: 1 ) - Please choose one The Huffman algorithm finds an exponential solution True False Question No: 9 ( Marks: 1 ) - Please choose one The Huffman algorithm finds a polynomial solution True False Question No: 10 ( Marks: 1 ) - Please choose one The greedy part of the Huffman encoding algorithm is to first find two nodes with larger frequency. True False Question No: 11 ( Marks: 1 ) - Please choose one The codeword assigned to characters by the Huffman algorithm have the property that no codeword is the postfix of any other. True False Question No: 12 ( Marks: 1 ) - Please choose one Huffman algorithm uses a greedy approach to generate a postfix code T that minimizes the expected length B (T) of the encoded string. True False Question No: 13 ( Marks: 1 ) - Please choose one Shortest path problems can be solved efficiently by modeling the road map as a graph. True False Question No: 14 ( Marks: 1 ) - Please choose one Dijkestras single source shortest path algorithm works if all edges weights are nonnegative and there are negative cost cycles. True False

Question No: 15 ( Marks: 1 ) - Please choose one Bellman-Ford allows negative weights edges and negative cost cycles. True False Question No: 16 ( Marks: 1 ) - Please choose one The term coloring came form the original application which was in architectural design. True False Question No: 17 ( Marks: 1 ) - Please choose one In the clique cover problem, for two vertices to be in the same group, they must be adjacent to each other. True False Question No: 18 ( Marks: 1 ) - Please choose one Dijkstras algorithm is operates by maintaining a subset of vertices True False Question No: 19 ( Marks: 1 ) - Please choose one The difference between Prims algorithm and Dijkstras algorithm is that Dijkstras algorithm uses a different key. True False Question No: 20 ( Marks: 1 ) - Please choose one Consider the following adjacency list:

Question No: 21 ( Marks: 1 ) - Please choose one We do sorting to, keep elements in random positions keep the algorithm run in linear order

keep the algorithm run in (log n) order keep elements in increasing or decreasing order Question No: 22 ( Marks: 1 ) - Please choose one After partitioning array in Quick sort, pivot is placed in a position such that Values smaller than pivot are on left and larger than pivot are on right Values larger than pivot are on left and smaller than pivot are on right Pivot is the first element of array Pivot is the last element of array Question No: 23 ( Marks: 1 ) - Please choose one Merge sort is stable sort, but not an in-place algorithm True False Question No: 24 ( Marks: 1 ) - Please choose one In counting sort, once we know the ranks, we simply _________ numbers to their final positions in an output array. Delete copy Mark arrange Question No: 25 ( Marks: 1 ) - Please choose one Dynamic programming algorithms need to store the results of intermediate subproblems. True False Question No: 26 ( Marks: 1 ) - Please choose one A p q matrix A can be multiplied with a q r matrix B. The result will be a p r matrix C. There are (p . r) total entries in C and each takes _________ to compute. O (q) O (1) O (n2) O (n3) Question No: 27 ( Marks: 2 ) Give a detailed example for 2-d maxima problem. Let took a point p in 2-dimensional space given by its integer coordinates, p = (p.x, p.y). A point p is said to dominated by point q if p.x q.x and p.y q.y.

Given a set of n points, P = {p1, p2, . . . , pn} in 2-space a point is said to be maximal if it is not dominated by any other point in P. The problem is to output all the maximal points of P. A brute-force algorithm that ran in (n2) time is used in it. It operated by comparing all pairs of points. the brute-force algorithm uses no intelligence in pruning out decisions. For example, once we know that a point pi is dominated by another point pj, we do not need to use pi for eliminating other points. This follows from the fact that dominance relation is transitive. If pj dominates pi and pi dominates ph then pj also dominates ph; pi is not needed. Question No: 28 ( Marks: 2 ) Differentiate between back edge and forward edge. For directed graphs edges r classified as: Back edge: (u, v) where v is an ancestor of u in the tree. Forward edge: (u, v) where v is a proper descendent of u in the tree. Cross edge: (u, v) where u and v are not ancestor or descendent of one another. In fact, the edge may go between different trees of the forest. Question No: 29 ( Marks: 2 ) How the generic greedy algorithm operates in minimum spanning tree? Ans: In undirected, connected graph whose edges have numeric weights are G = (V, E) Heres applying generic greedy algorithm operates in minimum spanning tree is simple. we maintain a subset of edges E of the graph . This subset is A. Initially, A is empty. We will add edges one at a time until A equals the MST. A subset A E is viable if A is a subset of edges of some MST. An edge (u, v) E A is safe if A {(u, v)} is viable. In other words, the choice (u, v) is a safe choice to add so that A can still be extended to form a MST. if A is viable, it cannot contain a cycle. A generic greedy algorithm operates by repeatedly adding any safe edge to the current spanning tree. Question No: 30 ( Marks: 2 )

( d ijk )

What are two cases for computing assuming we already have the previous d (k 1) using Floyed-Warshall algorithm? matrix

Ans:

The two cases for computing assuming we already have the previous matrix d using Floyed-Warshall algorithm are: 1. Dont go through vertex k at all. 2. Do go through vertex k Question No: 31 ( Marks: 3 ) Describe Minimum Spanning Trees Problem with examples. Question No: 32 ( Marks: 3 ) What is decision problem, also explain with example?

( d ijk )

( k 1)

Ans: A problem is called a decision problem if its output is a simple yes or no true/false, 0/1, Accept/reject.) For example: The MST decision problem would be a decision problem, Given a weighted graph G and an integer k, does G have a spanning tree whose weight is at most k? Question No: 33 ( Marks: 3 ) Prove that the generic TRAVERSE (S) marks every vertex in any connected graph exactly once and the set of edges (v, parent (v)) with parent (v) F form a spanning tree of the graph. Ans: Proof: it should be sured that no vertex is marked more than once. The algorithm marks s. Let v = s be a vertex and let s u v be a path from s to v with the minimum number of edges. Since the graph is connected, such a path always exists. If the algorithm marks u, then it must put (u, v) into the bag, so it must take (u, v) out of the bag at which point v must be marked. Thus, by induction on the shortest path distance from s, the algorithm marks every vertex in the graph. Call an edge (v, parent(v)) with parent(v) = , a parent edge. For any node v, the path of parent edges v parent(v) parent(parent(v)) . . . eventually leads back to s. So the set of parent edges form a connected graph. both end points of every parent edge are marked, and the number of edges is exactly one less than the number of vertices. Thus, the parent edges form a spanning tree. Question No: 34 ( Marks: 5 ) Suppose you could reduce an NP-complete problem to a polynomial time problem in polynomial time. What would be the consequence?

Question No: 35 ( Marks: 5 ) Prove the following lemma, Lemma: Given a digraph G = (V, E), consider any DFS forest of G and consider any edge (u, v) E. If this edge is a tree, forward or cross edge, then f[u] > f[v]. If this edge is a back edge, then f[u] f[v] Ans: Proof: For the non-tree forward and back edges the proof follows directly from the parenthesis lemma. For example, for a forward edge (u, v), v is a descendent of u and so vs start-nish interval is contained within us implying that v has an earlier nish time. For a cross edge (u, v) the two time intervals are disjoint. When we were processing u, v was not white (otherwise (u, v) would be a tree edge), implying that v was started before u. Because the intervals are disjoint, v must have also nished before u. Question No: 36 ( Marks: 5 ) What is the cost of the following graph?

DFS procedure can be written

1. recursively or 2. non-recursively.

RECURSIVEDFS(v)

if (v is unmarked ) then mark v for each edge (v,w) do RECURSIVEDFS(w)

ITERATIVEDFS(s)

PUSH(s) while stack not empty do v POP() if v is unmarked then mark v for each edge (v,w) do PUSH(w)

Total 36 Questions, 26 MCQs Using ASCII standard the string abacdaacac will be encoded with __________ bits. 80 160 320 100 Using ASCII standard the string abacdaacac will be encoded with 160 bits. True False Using ASCII standard the string abacdaacac will be encoded with 320 bits. True False Using ASCII standard the string abacdaacac will be encoded with 100 bits. True

False Please choose oneConsider the following Huffman Tree The binary code for the string TEA is

10 00 010 011 00 010 10 00 110 11 10 110 The book written by Al-Khwarzami Hisab al-jabr w'al mugabalah

The Huffman algorithm finds a (n) _____________ solution. Optimal Non-optimal Exponential Polynomial Huffman algorithm uses a greedy approach to generate a postfix code T that minimizes the expected length B (T) of the encoded string. True False The difference between Prims algorithm and Dijkstras algorithm is that Dijkstras algorithm uses a different key. True False

4 Questions of 2 Marks 1. Difference between Prims algorithm and Dijikstras algorithm. Ans: The difference between Prims algorithm and Dijkstras algorithm is that Dijkstras algorithm uses a different key. 2. 3. What is coloring problem? Is it better that we using brute force approach to solve knap sack problem, can we do better.

3 Questions of 3 Marks 1. following is the list of adjacency vertex, Identify that is any vertex have isolated property. a------- b-- c b------ d-- e e------ f-- d c----- b--- f f---- b g 2. How Dijikstras algorithm operate, give an example.

3 Questions of 5 Marks. 1. 2. 3. What is the reduction, Explain with example. (From Last chapter of handsout) Describe the Minimum spanning Tree with example. What is the cost of following Graph.

1: What is the time complexity to extract a vertex from the priority queue in Prims algorithm? log (v) v.v e.e log(e)

2: Which statement is true? If a dynamic-programming problem satisfies the optimal-substructure property, then a locally optimal solution is globally optimal. If a greedy choice property satisfies the optimal-substructure property, then a locally optimal solution is globally optimal. both of above none of above

3: 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

4: You have an adjacency list for G, what is the time complexity to compute Graph transpose G^T ? V+e v.e v

5: What general property of the list indicates that the graph has an isolated vertex? There is Null pointer at the end of list. The Isolated vertex is not handled in list. Only one value is entered in the list. There is at least one null list. 6: Which is true statement. Breadth first search is shortest path algorithm that works on un-weighted graphs. Depth first search is shortest path algorithm that works on un-weighted graphs. Both of above are true. None of above are true.

7: A dense undirected graph is: A graph in which E = O(V^2) A graph in which E = O(V) A graph in which E = O(log V) All items above may be used to characterize a dense undirected graph. 8: What is generally true of Adjacency List and Adjacency Matrix representations of graphs? Lists require less space than matrices but take longer to find the weight of an edge (v1,v2) Lists require less space than matrices and they are faster 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).

9: 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) O(|V | |E|) O(|V |^2|E|) O(|V | + |E|)

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

11: Using ASCII standard the string abacdaacacwe will be encoded with __________ bits 64 128 96 120

12: What is the time complexity to extract a vertex from the priority queue in Prims algorithm? log (V) v.v e.e log

13: the analysis of selection algorithm shows the total running time is indeed------------in n. arithmetic geometric linear orthogonal

14: back edge is (1) In Prims algorithm, the additional information maintained by the algorithm is the length of the shortest edge from vertex v to points already in the tree. A) TRUE B) FALSE C) UNKNOWN (2) Although it requires more complicated data structures, Prim's algorithm for a minimum spanning tree is better than Kruskal's when the graph has a large number of vertices. A) TRUE. B) FALSE C: UNKNOWN

(3) If a problem is NP-complete, it must also be in NP.

A) TRUE. B) FALSE

C) UNKNOWN (4) What is the worst-case runtime complexity of the following C function int function(int n){ int i, j, k; k = n; for(i=-100; i<10*log(n);i++){ k = k/2; } for(j=i; j> n; j--){ k=j/2; }r return k; } What order is the execution of this code a) O(log n) b) O(n) c) O(n log n) d) O(n2) e) O(n2 log n) (4) Which statement is true (I) The running time of Bellman-Ford algorithm is T (VE) (II) Both Dijkstras algorithm and Bellman-Ford are based on performing repeated relaxations (III) The 0-1 knapsack problem is hard to solve

5) Which of the following arrays represent descending (max) heaps? I. [10,7,7,2,4,6] II. [10,7,6,2,4,7] III. [10,6,7,2,4,6] IV. [6,6,7,2,4,10]

6. Which of the following statement(s) is/are correct? (a) O(n log n + n2) = O(n2). (b) O(n log n + n2) = O(n2 log 2n)

(c) O(c n2) = O(n2) where c is a constant. (d) O(c n2) = O(c) where c is a constant. (e) O(c) = O(1) where c is a constant. Only (a) & (e) Both (c) and (e)

7. Which of the shortest path algorithms would be most appropriate for finding paths in the graph with negative edge weights and cycles? I.Dijkstras Algorithm II. Bellman-Ford Algorithm III. Floyd Warshall Algorithm Only II Only III Both II & III

8. Which of the following orders is not a possible order in which Depth First Search can visit the vertices of the directed graph shown below?

9. Suppose we have two problems A and B .Problem A is polynomial-time reducible and problem B is NP-complete. If we reduce problem A into B then problem A becomes NPcomplete

Yes No

10. How can the number of strongly connected components of a graph change if a new edge is added? The number of strongly connected components can be increased. The number of strongly connected components can be reduced. No change will occur.

None of these.

11. The recurrence relation of Tower of Hanoi is given below ? 1 if n =1 T n =? -133( ) 2 (T n- +1) 1if n>1 In order to move a tower of 6 rings from one peg to another, how many moves are required? 15 7 63 32 12. Edge (u, v) is a forward edge if u is a proper descendant of v in the tree v is a proper descendant of u in the tree None of these 13. Is 22n= O? 2n -26? ? Yes it is possible No it is not possible None of these

14. If, in a DFS forest of digraph G = (V, E), f[u] = f[v] for an edge (u, v) ? E then the edge is called Back edge Forward edge Cross Edge Tree Edge None of these 15. How can the number of strongly connected components of a graph change if a new edge is added? The number of strongly connected components can be increased. The number of strongly connected components can be reduced. No change will occur. None of these.

16. Best and worst case times of an algorithm may be same. True False 17. Can an adjacency matrix for a directed graph ever not be square in shape? Yes No 18. If an algorithm has a complexity of 2n2+ 4n + 3 for some model of computation (some set of assumptions) and some complexity measures (such as number of comparison operations) we could say that it has complexity (a) O(log n) (b) O(n2) (c) O(2 + 4 + 3) (d) all of the above (e) none of the above

2

1. In which order we can sort? increasing order only decreasing order only increasing order or decreasing order both at the same time 2. heap is a left-complete binary tree that conforms to the ___________ increasing order only decreasing order only heap order (log n) order 3. In the analysis of Selection algorithm, we make a number of passes, in fact it could be as many as, T(n) T(n / 2) log n n/2+n/4 4. How much time merge sort takes for an array of numbers? T(n^2) T(n) T( log n) T(n log n) 5. One of the clever aspects of heaps is that they can be stored in arrays without using any _______________. pointers constants variables functions 6. the analysis of Selection algorithm, we eliminate a constant fraction of the array with each phase; we get the convergent _______________ series in the analysis linear arithmetic geometric exponent 7:. Sieve Technique applies to problems where we are interested in finding a single item from a larger set of _____________ n items phases pointers constant

8. The sieve technique works in ___________ as follows phases numbers integers routines 9. For the heap sort, access to nodes involves simple _______________ operations. arithmetic binary algebraic logarithmic 10. The analysis of Selection algorithm shows the total running time is indeed ________in n, arithmetic geometric linear orthogonal 11. Divide-and-conquer as breaking the problem into a small number of pivot Sieve smaller sub problems Selection 12. Slow sorting algorithms run in, T(n^2) T(n) T( log n) T(n log n) 13. A heap is a left-complete binary tree that conforms to the increasing order only decreasing order only heap order (log n) order 14. For the heap sort we store the tree nodes in level-order traversal in-order traversal pre-order traversal post-order traversal 15. The reason for introducing Sieve Technique algorithm is that it illustrates a very important special case of, divide-and-conquer,

16. We do sorting to, Select correct option: keep elements in random positions keep the algorithm run in linear order keep the algorithm run in (log n) order keep elements in increasing or decreasing order 17. Sorting is one of the few problems where provable ________ bonds exits on how fast we can sort, Select correct option: upper lower average log n For the heap sort we store the tree nodes in Select correct option: level-order traversal in-order traversal pre-order traversal post-order traversal 18: For the Sieve Technique we take time T(nk) T(n / 3) n^2 n/3 20: In Sieve Technique we do not know which item is of interest Select correct option: True False 21: Slow sorting algorithms run in, T(n^2) T(n) T( log n) T(n log n) 22: Divide-and-conquer as breaking the problem into a small number of pivot Sieve

23: For the sieve technique we solve the problem, recursively mathematically precisely accurately

24: we do sorting to, keep elements in random positions keep the algorithm run in linear order keep the algorithm run in (log n) order keep elements in increasing or decreasing order

25: The reason for introducing Sieve Technique algorithm is that it illustrates a very important special case of, divide-and-conquer decrease and conquer greedy nature 2-dimension Maxima

26: In Sieve Technique we do not know which item is of interest true false

27: In the analysis of Selection algorithm, we make a number of passes, in fact it could be as many as, T(n) T(n / 2) log n n/2+n/4

28: Divide-and-conquer as breaking the problem into a small number of pivot Sieve

29: A heap is a left-complete binary tree that conforms to the ___________ increasing order only decreasing order only heap order (log n) order

30: Slow sorting algorithms run in, T(n^2) T(n) T( log n) T(n log n)

31: One of the clever aspects of heaps is that they can be stored in arrays without using any _______________. pointers constants variables functions

32: Sorting is one of the few problems where provable ________ bonds exits on how fast we can sort, upper lower average log n

33: For the sieve technique we solve the problem, mathematically precisely accurately recursively

35: How much time merge sort takes for an array of numbers? (n^2) T(n) T( log n) T(n log n)

36; : For the Sieve Technique we take time T(nk) T(n / 3) n^2 n/3

37: Heaps can be stored in arrays without using any pointers; this is due to the ____________ nature of the binary tree, left-complete right-complete tree nodes tree leaves 38: How many elements do we eliminate in each time for the Analysis of Selection algorithm? n / 2 elements (n / 2) + n elements n / 4 elements 2 n elements

39: We do sorting to, keep elements in random positions keep the algorithm run in linear order keep the algorithm run in (log n) order keep elements in increasing or decreasing order

40: In which order we can sort? increasing order only decreasing order only increasing order or decreasing order both at the same time

41: : In the analysis of Selection algorithm, we make a number of passes, in fact it could be as many as,

42: The sieve technique is a special case, where the number of sub problems is just 5 Many 1 few

Question No: 1 ( Marks: 1 ) - Please choose one Random access machine or RAM is a/an Machine build by Al-Khwarizmi Mechanical machine Electronics machine Mathematical model Question No: 2 ( Marks: 1 ) - Please choose one _______________ is a graphical representation of an algorithm notation notation Flowchart Asymptotic notation Question No: 3 ( Marks: 1 ) - Please choose one A RAM is an idealized machine with ______________ random-access memory. 256MB 512MB an infinitely large 100GB Question No: 4 ( Marks: 1 ) - Please choose one What type of instructions Random Access Machine (RAM) can execute? Choose best answer Algebraic and logic Geometric and arithmetic Arithmetic and logic Parallel and recursive Question No: 5 ( Marks: 1 ) - Please choose one

What will be the total number of max comparisons if we run brute-force maxima algorithm with n elements? 2 n

n

n2 n n8

Question No: 6 ( Marks: 1 ) - Please choose one What is the solution to the recurrence T(n) = T(n/2)+n . O(logn) O(n) O(nlogn) O(n2) Question No: 7 ( Marks: 1 ) - Please choose one Consider the following code: For(j=1; j<n;j++) For(k=1; k<15;k++) For(l=5; l<n; l++) { Do_something_constant(); } What is the order of execution for this code. O(n) O(n3) O(n2 log n) O(n2) Question No: 8 ( Marks: 1 ) - Please choose one

Consider the following Algorithm: Factorial (n){ if (n=1) return 1 else return (n * Factorial(n-1)) { Recurrence for the following algorithm is:

T(n) = T(n-1) +1 T(n) = nT(n-1) +1 T(n)= T(n-1) +n T(n)=T(n(n-1)) +1 Question No: 9 ( Marks: 1 ) - Please choose one

What is the total time to heapify? (log n) (n log n) (n2 log n) (log2 n) Question No: 10 ( Marks: 1 ) - Please choose one When we call heapify then at each level the comparison performed takes time It will take (1) Time will vary according to the nature of input data It can not be predicted It will take (log n) Question No: 11 ( Marks: 1 ) - Please choose one In Quick sort, we dont have the control over the sizes of recursive calls True False Less information to decide Either true or false Question No: 12 ( Marks: 1 ) - Please choose one Is it possible to sort without making comparisons? Yes No Question No: 13 ( Marks: 1 ) - Please choose one If there are (n2) entries in edit distance matrix then the total running time is (1) (n2) (n) (n log n) Question No: 14 ( Marks: 1 ) - Please choose one For Chain Matrix Multiplication we can not use divide and conquer approach because, We do not know the optimum k We use divide and conquer for sorting only We can easily perform it in linear time Size of data is not given Question No: 15 ( Marks: 1 ) - Please choose one The Knapsack problem belongs to the domain of _______________ problems. Optimization NP Complete Linear Solution Sorting

Question No: 16 ( Marks: 1 ) - Please choose one Suppose we have three items as shown in the following table, and suppose the capacity of the knapsack is 50 i.e. W = 50. Item Value Weight 1 60 10 2 100 20 3 120 30 The optimal solution is to pick Items 1 and 2 Items 1 and 3 Items 2 and 3 None of these

3. ______________ graphical representation of algorithm. > asymptotic >. flowchart 4. who invented the quick sort C.A.R. Hoare

5. function is given like 4n^4+ 5n^3+n what is the run time of this

(n^4) (n^3) (4n^4+ 5n^3) (4n^4+ 5n^3)

6. main elements to a divide-and-conquer Divide---->conquer---------->combine 7. T(n)={4 if n=1, otherwise T(n/5)+3n^2 what is the answer if n=5 answer is 79

8. Merge sort is a stable algorithm but not an in-place algorithm. >True >false _______________ is a graphical representation of an algorithm notation Flowchart Asymptotic notation

Question No: 2

Which of the following is calculated with Big o notation? Lower bounds Upper bounds Both upper and lower bound Medium bounds Question No: 3 ( Marks: 1 ) - Please choose one Merge sort makes two recursive calls. Which statement is true after these recursive calls finish, but before the merge step? The array elements form a heap Elements in each half of the array are sorted amongst themselves Elements in the first half of the array are less than or equal to elements in the second half of the array None of the above Question No: 4 ( Marks: 1 ) - Please choose one Who invented Quick sort procedure? Hoare Sedgewick Mellroy Coreman Question No: 5 ( Marks: 1 ) - Please choose one What is the solution to the recurrence T(n) = T(n/2)+n, T(1) = 1 O(logn) O(n) O(nlogn) O(2n) FINALTERM EXAMINATION Fall 2008

CS502- Fundamentals of Algorithms (Session - 1) Marks: 75 Question No: 1 ( Marks: 1 ) - Please choose one _______________ is a graphical representation of an algorithm notation

Flowchart

Asymptotic notation notation Question No: 2 ( Marks: 1 ) - Please choose one Which of the following is calculated with Bigo notation? Lower bounds

Upper bounds

Both upper and lower bound Medium bounds Question No: 3 ( Marks: 1 ) - Please choose one Merge sort makes two recursive calls. Which statement is true after these recursive calls finish, but before the merge step? The array elements form a heap

Elements in the first half of the array are less than or equal to elements in the second half of the array None of the above Question No: 4 ( Marks: 1 ) - Please choose one Who invented Quick sort procedure?

Hoare

Sedgewick Mellroy Coreman

Question No: 5 ( Marks: 1 ) - Please choose one What is the solution to the recurrence T(n) = T(n/2)+n, T(1) = 1 O(logn) O(n)

O(nlogn)

O(2n) Question No: 6 ( Marks: 1 ) - Please choose one(Huffman tree is missing) Consider the following Huffman Tree The binary code for the string TEA is 10 00 010

011 00 010 10 00 110 11 10 110 Question No: 7 ( Marks: 1 ) - Please choose one If a graph has v vertices and e edges then to obtain a spanning tree we have to delete v edges. v e + 5 edges v + e edges. None of these Question No: 8 ( Marks: 1 ) - Please choose one Can an adjacency matrix for a directed graph ever not be square in shape? Yes No

Question No: 9 ( Marks: 1 ) - Please choose one One of the clever aspects of heaps is that they can be stored in arrays without using any _______________. Pointers constants variables functions Question No: 10 ( Marks: 1 ) - Please choose one Merge sort requires extra array storage, True False Question No: 11 ( Marks: 1 ) - Please choose one Non-optimal or greedy algorithm for money change takes____________ O(k) O(kN) O(2k) O(N) Question No: 12 ( Marks: 1 ) - Please choose one The Huffman codes provide a method of encoding data inefficiently when coded using ASCII standard.

True False Question No: 13 ( Marks: 1 ) - Please choose one Using ASCII standard the string abacdaacac will be encoded with __________ bits. 80 160 320 100 Question No: 14 ( Marks: 1 ) - Please choose one Using ASCII standard the string abacdaacac will be encoded with 160 bits. True False Question No: 15 ( Marks: 1 ) - Please choose one Using ASCII standard the string abacdaacac will be encoded with 320 bits. True False Question No: 16 ( Marks: 1 ) - Please choose one Using ASCII standard the string abacdaacac will be encoded with 100 bits. True False Question No: 17 ( Marks: 1 ) - Please choose one Using ASCII standard the string abacdaacac will be encoded with 32 bytes True False Question No: 18 ( Marks: 1 ) - Please choose one The greedy part of the Huffman encoding algorithm is to first find two nodes with smallest frequency. True False Question No: 19 ( Marks: 1 ) - Please choose one The greedy part of the Huffman encoding algorithm is to first find two nodes with

character frequency True False Question No: 20 ( Marks: 1 ) - Please choose one Huffman algorithm uses a greedy approach to generate an antefix code T that minimizes the expected length B (T) of the encoded string. True False Question No: 21 ( Marks: 1 ) - Please choose one Depth first search is shortest path algorithm that works on un-weighted graphs. True False Question No: 22 ( Marks: 1 ) - Please choose one Dijkestra s single source shortest path algorithm works if all edges weights are nonnegative and there are no negative cost cycles. True False Question No: 23 ( Marks: 1 ) - Please choose one Dijkestra s single source shortest path algorithm works if all edges weights are negative and there are no negative cost cycles. True False hb Question No: 24 ( Marks: 1 ) - Please choose one Floyd-Warshall algorithm is a dynamic programming algorithm; the genius of the algorithm is in the clever recursive formulation of the shortest path problem. True Flase

Question No: 25 ( Marks: 1 ) - Please choose one Floyd-Warshall algorithm, as in the case with DP algorithms, we avoid recursive evaluation by generating a table for k ij d True

Flase Question No: 26 ( Marks: 1 ) - Please choose one The term coloring came form the original application which was in map drawing. True False

Question No: 27 ( Marks: 1 ) - Please choose one In the clique cover problem, for two vertices to be in the same group, they must be _______________each other. Apart from Far from Near to Adjacent to Question No: 28 ( Marks: 1 ) - Please choose one In the clique cover problem, for two vertices to be in the same group, they must be apart from each other. True False Question No: 29 ( Marks: 1 ) - Please choose one The difference between Prim s algorithm and Dijkstra s algorithm is that Dijkstra s algorithm uses a different key. True False Question No: 30 ( Marks: 1 ) - Please choose one The difference between Prim s algorithm and Dijkstra s algorithm is that Dijkstra s algorithm uses a same key. True False Question # 1 of 10 ( Start time: 06:18:58 PM ) Total Marks: 1 We do sorting to, Select correct option: keep elements in random positions keep the algorithm run in linear order keep the algorithm run in (log n) order keep elements in increasing or decreasing order

Question # 2 of 10 ( Start time: 06:19:38 PM ) Total Marks: 1 Heaps can be stored in arrays without using any pointers; this is due to the ____________ nature of the binary tree, Select correct option: left-complete right-complete tree nodes tree leaves Sieve Technique can be applied to selection problem? Select correct option: True False Question # 4 of 10 ( Start time: 06:21:10 PM ) Total Marks: 1 A heap is a left-complete binary tree that conforms to the ___________ Select correct option: increasing order only decreasing order only heap order (log n) order Question # 5 of 10 ( Start time: 06:21:39 PM ) Total Marks: 1 A (an) _________ is a left-complete binary tree that conforms to the heap order Select correct option: heap binary tree binary search tree array Question # 6 of 10 ( Start time: 06:22:04 PM ) Total Marks: 1 Divide-and-conquer as breaking the problem into a small number of Select correct option: pivot Sieve smaller sub problems Selection Question # 7 of 10 ( Start time: 06:22:40 PM ) Total Marks: 1 In Sieve Technique we do not know which item is of interest Select correct option:

True False Question # 8 of 10 ( Start time: 06:23:26 PM ) Total Marks: 1 The recurrence relation of Tower of Hanoi is given below T(n)={1 if n=1 and 2T(n-1) if n >1 In order to move a tower of 5 rings from one peg to another, how many ring moves are required? Select correct option: 16 10 32 31 (yeh just tukkahai) Question # 9 of 10 ( Start time: 06:24:44 PM ) Total Marks: 1 In the analysis of Selection algorithm, we eliminate a constant fraction of the array with each phase; we get the convergent _______________ series in the analysis, Select correct option: linear arithmetic geometric (yeh b gup hi lugtihai) exponent Question # 10 of 10 ( Start time: 06:25:43 PM ) Total Marks: 1 For the heap sort, access to nodes involves simple _______________ operations. Select correct option: arithmetic binary algebraic logarithmic (bongihai...)

Question No: 31 ( Marks: 1 ) Do you think greedy algorithm gives an optimal solution to the activity scheduling problem? yes, greedy algorithm gives an optimal solution to the activity scheduling problem. as we have the data as a whole ,and activity a1 must be started at a given start time and ends at a given finish time. all the intermediate activities who overlap will be excluded automatically as no new activity will be selected as our data till the finish of last activity. so this greediness of algorithm gives us the optimal solution.

Question No: 32 ( Marks: 1 ) Define Forward edge A forward edge is a non-tree edge that connects a vertex to a descendent in a DFStree. Question No: 33 ( Marks: 2 ) Is there any relationship between number of back edges and number of cycles in DFS? A back edge connects a vertex to an ancestor in a DFS-tree. No back edges means no cycles. But there is some simple relationship Between the number of back edges and the number of cycles. For example, a DFS tree may only have a single back edge, and there may anywhere from one up to an exponential number of simple cycles in the graph.

Question No: 34 ( Marks: 2 ) What is the common problem in communications networks and circuit designing? Common problem in communications networks and circuit design is that of connecting together a set of nodes by a network of total minimum length. The length is the sum of lengths of connecting wires. Question No: 35 ( Marks: 3 ) Let the adjacency list representation of an undirected graph is given below. Explain what general property of the list indicates that the graph has an isolated vertex. abce bad cadef dbcf eacf fcde g Ans: A graph is connected if every vertex can reach Every other vertex. and is isolated if any node has not connected to other vertex ,heres g is the node that is not connected with any other vertex. This general property of the list indicates that the graph has an isolated vertex.

03-11-2010

Top of Form

/wEPDwUKMTY2N /wEWCgKwyJHhD

Time Left

35

sec(s)

Quiz Start Time: 11:20 PM Question # 1 of 10 ( Start time: 11:20:20 PM ) The number of nodes in a complete binary tree of height h is Select correct option:

2^(h+1) 1

Total Marks: 1

2 * (h+1) 1

2 * (h+1)

((h+1) ^ 2) 1

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgLM9c6GB

Time Left

81

sec(s)

Question # 2 of 10 ( Start time: 11:21:44 PM ) A heap is a left-complete binary tree that conforms to the ___________ Select correct option:

increasing order only

Total Marks: 1

heap order

(log n) order

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgK5yJH0C

Time Left

79

sec(s)

Quiz Start Time: 11:20 PM Question # 3 of 10 ( Start time: 11:22:29 PM ) In which order we can sort? Select correct option:

increasing order only

Total Marks: 1

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgKC78FiAr

Time Left

8

sec(s)

Quiz Start Time: 11:20 PM Question # 4 of 10 ( Start time: 11:22:57 PM ) Total Marks: 1 Consider the following Algorithm: Fun(n){ if (n=1) return 1 else return (n * Fun(n-1)) } Recurrence for the above algorithm is: Select correct option:

nT(n-1)+1

2T(n-1)+1

T(n-1)+cn

T(n-1)+1

Bottom of Form Top of Form

/wEPDwUKMTY2N

/wEWCgKK8J16A

Time Left

7

sec(s)

Quiz Start Time: 11:20 PM Question # 5 of 10 ( Start time: 11:24:25 PM ) How much time merge sort takes for an array of numbers? Select correct option:

T(n^2)

Total Marks: 1

T(n)

T( log n)

T(n log n)

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWBgKp0t/HCw

Time Left

17

sec(s)

Quiz Start Time: 11:20 PM Question # 6 of 10 ( Start time: 11:25:57 PM ) Sieve Technique can be applied to selection problem? Select correct option:

True

Total Marks: 1

False

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgKphcL+A

Time Left

72

sec(s)

Quiz Start Time: 11:20 PM Question # 7 of 10 ( Start time: 11:27:23 PM ) Total Marks: 1 The reason for introducing Sieve Technique algorithm is that it illustrates a very important special case of, Select correct option:

divide-and-conquer

greedy nature

2-dimension Maxima

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgLShL2ZCA

Time Left

20

sec(s)

Question # 8 of 10 ( Start time: 11:27:57 PM ) The analysis of Selection algorithm shows the total running time is indeed ________in n, Select correct option:

arithmetic

Total Marks: 1

geometric

linear

orthogonal

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgK8/peKBQ

Time Left

42

sec(s)

Quiz Start Time: 11:20 PM Question # 9 of 10 ( Start time: 11:29:27 PM ) For the Sieve Technique we take time Select correct option:

T(nk)

Total Marks: 1

T(n / 3)

n^2

n/3

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgKQ9dDrA

Time Left

23

sec(s)

Quiz Start Time: 11:20 PM Question # 10 of 10 ( Start time: 11:30:44 PM ) How many elements do we eliminate in each time for the Analysis of Selection algorithm? Select correct option:

n / 2 elements

Total Marks: 1

(n / 2) + n elements

n / 4 elements

2 n elements

Bottom of Form

Time Left

55

Question # 1 of 10 ( Start time: 06:18:58 PM ) Marks: 1 We do sorting to, Select correct option: keep keep keep keep

Total

elements in random positions the algorithm run in linear order the algorithm run in (log n) order elements in increasing or decreasing order

Time Left

62

Question # 2 of 10 ( Start time: 06:19:38 PM ) Total Marks: 1 Heaps can be stored in arrays without using any pointers; this is due to the ____________ nature of the binary tree, Select correct option: left-complete right-complete tree nodes tree leaves

Time Left

77

Question # 3 of 10 ( Start time: 06:20:18 PM ) Total Marks: 1 Sieve Technique can be applied to selection problem? Select correct option: True False

Time Left

74

Question # 4 of 10 ( Start time: 06:21:10 PM ) Total Marks: 1 A heap is a left-complete binary tree that conforms to the ___________ Select correct option: increasing order only decreasing order only heap order (log n) order

Time Left

77

Question # 5 of 10 ( Start time: 06:21:39 PM ) Total Marks: 1 A (an) _________ is a left-complete binary tree that conforms to the heap order

Select correct option: heap binary tree binary search tree array

Time Left

72

Question # 6 of 10 ( Start time: 06:22:04 PM ) Total Marks: 1 Divide-and-conquer as breaking the problem into a small number of Select correct option: pivot Sieve smaller sub problems Selection

Time Left

48

Total

In Sieve Technique we do not know which item is of interest Select correct option: True False

Time Left

34

Question # 8 of 10 ( Start Marks: 1 The recurrence relation of T(n)={1 if n=1 and 2T(n-1) of 5 rings from one peg to required? Select correct option: 16 10 32 31 (yeh just tukka hai)

time: 06:23:26 PM )

Total

Tower of Hanoi is given below if n >1 In order to move a tower another, how many ring moves are

Time Left

36

Total

In the analysis of Selection algorithm, we eliminate a constant fraction of the array with each phase; we get the convergent _______________ series in the analysis, Select correct option: linear arithmetic geometric (yeh b gup hi lugti hai) exponent

Time Left

76

Question # 10 of 10 ( Start time: 06:25:43 PM ) Total Marks: 1 For the heap sort, access to nodes involves simple _______________ operations. Select correct option: arithmetic binary algebraic logarithmic (bongi hai...) Question # 1 of 10 ( Start time: 10:02:41 PM ) Total Marks: 1 For the sieve technique we solve the problem, Select correct option: recursively mathematically precisely accurately The sieve technique works in ___________ as follows Select correct option: phases numbers integers routines Slow sorting algorithms run in, Select correct option:

T(n^2) T(n) T( log n) A (an) _________ is a left-complete binary tree that conforms to the heap order Select correct option: heap binary tree binary search tree array In the analysis of Selection algorithm, we eliminate a constant fraction of the array with each phase; we get the convergent _______________ series in the analysis, Select correct option: linear arithmetic geometric exponent In the analysis of Selection algorithm, we make a number of passes, in fact it could be as many as, Select correct option: T(n) T(n / 2) log n n/2+n/4 The sieve technique is a special case, where the number of sub problems is just Select correct option: 5 many 1 few In which order we can sort? Select correct option: increasing order only decreasing order only increasing order or decreasing order both at the same time The recurrence relation of Tower of Hanoi is given below T(n)={1 if n=1 and 2T(n-1) if n >1 In order to move a tower of 5 rings from one peg to another, how many ring moves are required? Select correct option: 16 10

32 31 Analysis of Selection algorithm ends up with, Select correct option: T(n) T(1 / 1 + n) T(n / 2) T((n / 2) + n) Last message received on 10/13 at 12:43 AM Khanjee: We do sorting to, Select correct option: keep elements in random positions keep the algorithm run in linear order keep the algorithm run in (log n) order keep elements in increasing or decreasing order

Khanjee: Divide-and-conquer as breaking the problem into a small number of Select correct option: pivot Sieve smaller sub problems Selection The analysis of Selection algorithm shows the total running time is indeed ________in n, Select correct option: arithmetic geometric linear orthogonal

How many elements do we eliminate in each time for the Analysis of Selection algorithm? Select correct option:

Sieve Technique can be applied to selection problem? Select correct option: True

For the heap sort we store the tree nodes in Select correct option: level-order traversal in-order traversal pre-order traversal post-order traversal 1-One of the clever aspects of heaps is that they can be stored in arrays without using any _______________.

pointers ** constants variables functions 2- For the heap sort we store the tree nodes in

pre-order traversal post-order traversal 3- The sieve technique works in ___________ as follows phases numbers integers ** not confrm routines

4- In the analysis of Selection algorithm, we eliminate a constant fraction of the array with each phase; we get the convergent _______________ series in the analysis,

5- We do sorting to,

keep elements in random positions keep the algorithm run in linear order

keep the algorithm run in (log n) order keep elements in increasing or decreasing order *** 6- In the analysis of Selection algorithm, we make a number of passes, in fact it could be as many as,

7- In which order we can sort? increasing order only decreasing order only increasing order or decreasing order *** both at the same time 8- In Sieve Technique we do not know which item is of interest True** False 9- For the sieve technique we solve the problem,

recursively**

mathematically precisely

Question # 1 of 10 Total Marks: 1 Divide-and-Conquer is as breaking the problem into a small number of Smaller Sub Problems Pivot Sieve Solutions Question # 2 of 10 Total Marks: 1 Analysis of Selection Sort ends up with T(n) T(1/1+n) T(n/2) T((n/2) +n) Question # 3 of 10 Total Marks: 1 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 Question # 4 of 10 Total Marks: 1 A heap is a left-complete binary tree that conforms to the ?

Increasing Order Decreasing order Heap Order (nlog n) order Question # 5 of 10 Total Marks: 1 The Sieve Sequence is a special case where the number of smaller sub problems is just_ . 4 Many 1 Few

Imrangee

Heaps can be stored in arrays without using any pointers this is due to the of the binary tree?

Tree Nodes Right-Complete Nature Left-Complete Nature Tree Leaves Question # 7 of 10 Total Marks: 1

For the Heap Sort access to nodes involves simple _ operations:

Geometric Linear Arithmetic Algebraic Question # 8 of 10 Total Marks: 1 The Analysis of Selection Sort shows that the total running time is indeed in n? Geometric Linear Arithmetic Algebraic Question # 9 of 10 Total Marks: 1 For the sieve technique we solve the problem Recursively Randomly Mathematically Precisely

Question # 10 of 10 Total Marks: 1 How much time merger sort takes for an array of numbers? T(n^2) T(n) T(log n) T(n log n)

Top of Form

MC090406505 :

Time Left

86

sec(s)

Quiz Start Time: 06:48 PM Question # 1 of 10 ( Start time: 06:48:26 PM ) Total Marks: 1 How many elements do we eliminate in each time for the Analysis of Selection algorithm? Select correct option:

n / 2 elements

(n / 2) + n elements

n / 4 elements

2 n elements

Bottom of Form Top of Form

MC090406505 :

Time Left 83

sec(s) Quiz Start Time: 06:48 PM Question # 2 of 10 ( Start time: 06:49:01 PM ) Total Marks: 1 The recurrence relation of Tower of Hanoi is given below T(n)={1 if n=1 and 2T(n-1) if n >1 In order to move a tower of 5 rings from one peg to another, how many ring moves are required? Select correct option:

16

10

32

31

Bottom of Form Top of Form

MC090406505 :

Time Left

85

sec(s)

Quiz Start Time: 06:48 PM Question # 3 of 10 ( Start time: 06:49:38 PM ) The number of nodes in a complete binary tree of height h is Select correct option: Total Marks: 1

2^(h+1) 1

2 * (h+1) 1

2 * (h+1)

((h+1) ^ 2) 1

Bottom of Form Top of Form

MC090406505

Time Left

87

sec(s)

Quiz Start Time: 06:48 PM Question # 4 of 10 ( Start time: 06:50:58 PM ) Total Marks: 1 One of the clever aspects of heaps is that they can be stored in arrays without using any _______________. Select correct option:

pointers

constants

variables

functions

Bottom of Form Top of Form

MC090406505 :

Time Left

83

sec(s)

Quiz Start Time: 06:48 PM Question # 5 of 10 ( Start time: 06:51:24 PM ) We do sorting to, Select correct option:

keep elements in random positions

Total Marks: 1

Bottom of Form Top of Form

MC090406505 :

Time Left

87

sec(s)

Quiz Start Time: 06:48 PM Question # 6 of 10 ( Start time: 06:52:04 PM ) In Sieve Technique we do not know which item is of interest Select correct option:

True

Total Marks: 1

False

Bottom of Form Top of Form

MC090406505 :

Time Left

83

sec(s)

Quiz Start Time: 06:48 PM Question # 7 of 10 ( Start time: 06:52:27 PM ) Total Marks: 1 Consider the following Algorithm: Fun(n){ if (n=1) return 1 else return (n * Fun(n-1)) } Recurrence for the above algorithm is: Select correct option:

nT(n-1)+1

2T(n-1)+1

T(n-1)+cn

T(n-1)+1

Bottom of Form Top of Form

MC090406505 :

Time Left

85

sec(s)

Quiz Start Time: 06:48 PM Question # 8 of 10 ( Start time: 06:53:56 PM ) Total Marks: 1 In the analysis of Selection algorithm, we make a number of passes, in fact it could be as many as, Select correct option:

T(n)

T(n / 2)

log n

n/2+n/4

Bottom of Form Top of Form

MC090406505 :

Time Left 84

sec(s) Quiz Start Time: 06:48 PM Question # 9 of 10 ( Start time: 06:54:25 PM ) Total Marks: 1 The reason for introducing Sieve Technique algorithm is that it illustrates a very important special case of, Select correct option:

divide-and-conquer

greedy nature

2-dimension Maxima

Bottom of Form Top of Form

MC090406505 :

Time Left

84

sec(s)

Quiz Start Time: 06:48 PM Question # 9 of 10 ( Start time: 06:54:25 PM ) Total Marks: 1 The reason for introducing Sieve Technique algorithm is that it illustrates a very important special case of, Select correct option:

divide-and-conquer

greedy nature

2-dimension Maxima

Bottom of Form Top of Form

MC090406505 :

Time Left

80

sec(s)

Quiz Start Time: 06:48 PM Question # 10 of 10 ( Start time: 06:54:55 PM ) In which order we can sort? Select correct option:

increasing order only

Total Marks: 1

1 - What type of instructions Random Access Machine (RAM) can execute? Choose best answer 1. Algebraic and logic 2. Geometric and arithmetic 3. Arithmetic and logic 4. Parallel and recursive Correct Choice : 3 From Lectuer # 1

www.vugujranwala.com

2 - Random access machine or RAM is a/an 1. Machine build by Al-Khwarizmi 2. Mechanical machine 3. Electronics machine 4. Mathematical model Correct Choice : 4 From Lectuer # 1

www.vugujranwala.com

3 - _______________ is a graphical representation of an algorithm 1. Segma Notation 2. Thita Notation 3. Flowchart 4. Asymptotic notation Correct Choice : 3 From Lectuer # 2

www.vugujranwala.com

4 - What will be the total number of max comparisons if we run brute-force maxima algorithm with n elements? 1. n^2 2. n^n/2 3. n 4. n^8 Correct Choice : 1 From Lectuer # 3

both at the same time

Bottom of Form

www.vugujranwala.com

5 - function is given like 4n^4+ 5n^3+n what is the run time of this 1. theata(n^4) 2. theata(n^3) 3. theata(4n^4+ 5n^3) 4. theata(4n^4+ 5n^3) Correct Choice : 1 From Lectuer # 4

www.vugujranwala.com

www.vugujranwala.com

www.vugujranwala.com

8 - Let us say we have an algorithm that carries out N2 operations for an input of size N. Let us say that a computer takes 1 microsecond (1/1000000 second) to carry out one operation. How long does the algorithm run for an input of size 3000? 1. 90 seconds 2. 9 seconds 3. 0.9 seconds 4. 0.09 seconds Correct Choice : 2 From Lectuer # 4

www.vugujranwala.com

9 - The appropriate big thita classification of the given function. f(n) = 4n2 + 97n + 1000 is 1. ?(n) 2. O(2^n) 3. O(n^2) 4. O(n^2logn) Correct Choice : 3 From Lectuer # 4

www.vugujranwala.com

10 - The appropriate big ? classification of the given function. f(n) = 4n2 + 97n + 1000 is 1. ?(n) 2. O(2^n) 3. O(n^2) 4. O(n^2logn) Correct Choice : 3 From Lectuer # 4

www.vugujranwala.com

11 - Which sorting algorithm is faster 1. O (n log n) 2. O n^2 3. O (n+k) 4. O n^3 Correct Choice : 3 From Lectuer # 5

www.vugujranwala.com

12 - If algorithm A has running time 7n^2 + 2n + 3 and algorithm B has running time 2n^2, then 1. Both have same asymptotic time complexity 2. A is asymptotically greater 3. B is asymptotically greater 4. None of others

www.vugujranwala.com

13 - If algorithm A has running time 7n^2 + 2n + 3 and algorithm B has running time 2n^2, then 1. Both have same asymptotic time complexity 2. A is asymptotically greater 3. B is asymptotically greater 4. None of others Correct Choice : 1 From Lectuer # 6

www.vugujranwala.com

14 - What is the solution to the recurrence T(n) = T(n/2)+n . 1. O(logn) 2. O(n) 3. O(nlogn) 4. O(n^2) Correct Choice : 1 From Lectuer # 8

www.vugujranwala.com

15 - How much time merge sort takes for an array of numbers? 1. (n^2) 2. T(n) 3. T( log n) 4. T(n log n) Correct Choice : 2 From Lectuer # 8

www.vugujranwala.com www.vugujranwala.com

17 - Consider the following Algorithm: Factorial (n){ if (n=1) return 1 else return (n * Factorial(n-1)) } Recurrence for the following algorithm is:

1. T(n) = T(n-1) +1 2. T(n) = nT(n-1) +1 3. T(n)= T(n-1) +n 4. T(n)=T(n(n-1)) +1 Correct Choice : 4 From Lectuer # 9

www.vugujranwala.com

www.vugujranwala.com www.vugujranwala.com

20 - Sieve Technique applies to problems where we are interested in finding a single item from a larger set of _____________ 1. n items 2. phases 3. pointers 4. constant Correct Choice : 1 From Lectuer # 10

www.vugujranwala.com www.vugujranwala.com

22 - In Sieve Technique we do not know which item is of interest 1. FALSE 2. TRUE 3. 4. Correct Choice : 2 From Lectuer # 10

www.vugujranwala.com

23 - For the sieve technique we solve the problem, 1. recursively 2. mathematically 3. accurately 4. precisely Correct Choice : 1 From Lectuer # 10

www.vugujranwala.com

24 - For the Sieve Technique we take time 1. T(nk) 2. T(n / 3) 3. n^2 4. n/3 Correct Choice : 1 From Lectuer # 10

www.vugujranwala.com

25 - How many elements do we eliminate in each time for the Analysis of Selection algorithm? 1. n / 2 elements 2. (n / 2) + n elements 3. n / 4 elements 4. n elements

www.vugujranwala.com

26 - Sieve Technique applies to problems where we are interested in finding a single item from a larger set of _____________ 1. n items 2. phases 3. pointers 4. constant Correct Choice : 1 From Lectuer # 10

www.vugujranwala.com

27 - Sieve Technique can be applied to selection problem? 1. TRUE 2. FALSE 3. 4. Correct Choice : 1 From Lectuer # 10

www.vugujranwala.com

28 - The analysis of Selection algorithm shows the total running time is indeed ________in n,

www.vugujranwala.com

29 - The reason for introducing Sieve Technique algorithm is that it illustrates a very important special case of, 1. divide-and-conquer 2. decrease and conquer 3. greedy nature 4. 2-dimension Maxima Correct Choice : 1 From Lectuer # 10

www.vugujranwala.com

30 - The sieve technique works in ___________ as follows 1. phases 2. numbers 3. integers 4. routines Correct Choice : 1 From Lectuer # 10

www.vugujranwala.com

www.vugujranwala.com

32 - A (an) _________ is a left-complete binary tree that conforms to the heap order 1. heap 2. binary tree 3. binary search tree 4. array Correct Choice : 1 From Lectuer # 11

www.vugujranwala.com www.vugujranwala.com

34 - For the heap sort, access to nodes involves simple _______________ operations. 1. arithmetic 2. binary 3. algebraic 4. logarithmic Correct Choice : 1 From Lectuer # 11

www.vugujranwala.com www.vugujranwala.com

www.vugujranwala.com

37 - We do sorting to, 1. keep elements in random positions 2. keep the algorithm run in linear order 3. keep the algorithm run in (log n) order 4. keep elements in increasing or decreasing order Correct Choice : 1 From Lectuer # 11

www.vugujranwala.com www.vugujranwala.com

www.vugujranwala.com

www.vugujranwala.com

www.vugujranwala.com

42 - For the heap sort we store the tree nodes in 1. level-order traversal 2. in-order traversal 3. pre-order traversal 4. post-order traversal Correct Choice : 1 From Lectuer # 11 www.vugujr anwala.com

www.vugujr 44 - In the analysis of Selection algorithm, we make a number of passes, in fact it could be as anwala.com many as, 1. T(n) 2. T(n / 2) 3. log n 4. n / 2 + n / 4 Correct Choice : 3 From Lectuer # 11

www.vugujranwala.com

45 - In the analysis of Selection algorithm, we make a number of passes, in fact it could be as many as, 1. T(n) 2. T(n / 2) 3. log n 4. n / 2 + n / 4 Correct Choice : 3 From Lectuer # 11

www.vugujranwala.com

46 - In which order we can sort? 1. increasing order only 2. decreasing order only 3. increasing order or decreasing order 4. both at the same time Correct Choice : 3 From Lectuer # 11

www.vugujranwala.com

47 - One of the clever aspects of heaps is that they can be stored in arrays without using any _______________. 1. pointers 2. constants 3. variables 4. functions Correct Choice : 1 From Lectuer # 11

www.vugujranwala.com

48 - One of the clever aspects of heaps is that they can be stored in arrays without using any _______________. 1. pointers 2. constants 3. variables 4. functions Correct Choice : 1 From Lectuer # 11

www.vugujranwala.com

www.vugujranwala.com

50 - What is the total time to heapify? 1. ?(log n) 2. ?(n log n) 3. ?(n^2 log n) 4. ?(log^2n) Correct Choice : 1 From Lectuer # 12

www.vugujranwala.com

-When we call heapify then at each level the comparison performed takes time It will take O (1) 1. Time will vary according to the nature of input data 2. It can not be predicted 3. It will take O (log n) 4. None of the Given Correct Choice : 3 From Lectuer # 12

www.vugujranwala.com www.vugujranwala.com

53 - After partitioning array in Quick sort, pivot is placed in a position such that 1. Values smaller than pivot are on left and larger than pivot are on right 2. Values larger than pivot are on left and smaller than pivot are on right 3. Pivot is the first element of array 4. Pivot is the last element of array Correct Choice : 2 From Lectuer # 13

www.vugujranwala.com

54 - The running time of quick sort depends heavily on the selection of 1. No of inputs 2. Arrangement of elements in array 3. Size o elements 4. Pivot element Correct Choice : 4 From Lectuer # 13

www.vugujranwala.com

55 - In Quick Sort Constants hidden in T(n log n) are 1. Large 2. Medium 3. Small 4. Not Known Correct Choice : 3 From Lectuer # 14

www.vugujranwala.com

56 - In Quick Sort Constants hidden in T(n log n) are 1. Large 2. Medium 3. Small 4. Not Known Correct Choice : 3 From Lectuer # 14

www.vugujranwala.com

57 - Is it possible to sort without making comparisons? 1. Yes 2. No 3. 4. Correct Choice : 1 From Lectuer # 15

www.vugujranwala.com

58 - Merge sort is stable sort, but not an in-place algorithm 1. TRUE 2. FALSE 3. 4. Correct Choice : 1 From Lectuer # 15

www.vugujranwala.com

59 - In counting sort, once we know the ranks, we simply _________ numbers to their final positions in an output array. 1. Delete 2. copy 3. Mark 4. arrange Correct Choice : 2 From Lectuer # 15

www.vugujranwala.com

60 - An in place sorting algorithm is one that uses ___ arrays for storage 1. Two dimensional arrays 2. More than one array 3. No Additional Array 4. None of the above Correct Choice : 3 From Lectuer # 15

www.vugujranwala.com

61 - Continuation/counting sort is suitable to sort the elements in range 1 to k 1. K is Large 2. K is not known 3. K may be small or large 4. K is small

www.vugujranwala.com

62 - In stable sorting algorithm. 1. If duplicate elements remain in the same relative position after sorting 2. One array is used 3. More than one arrays are required 4. Duplicating elements not handled Correct Choice : 1 From Lectuer # 15

www.vugujranwala.com

63 - One example of in place but not stable algorithm is 1. Merger Sort 2. Quick Sort 3. Continuation Sort 4. Bubble Sort Correct Choice : 2 From Lectuer # 15

www.vugujranwala.com

64 - One example of in place but not stable algorithm is 1. Merger Sort 2. Quick Sort 3. Continuation Sort 4. Bubble Sort Correct Choice : 2 From Lectuer # 15

www.vugujranwala.com

65 - One of the clever aspects of heaps is that they can be stored in arrays without using any _______________. 1. pointers 2. constants 3. variables 4. functions Correct Choice : 1 66 - Quick sort is 1. Stable & in place 2. Not stable but in place 3. Stable but not in place 4. Some time stable & some times in place Correct Choice : 3 From Lectuer # 15

www.vugujranwala.com

From Lectuer # 15

www.vugujranwala.com

67 - Quick sort is 1. Stable & in place 2. Not stable but in place 3. Stable but not in place

4. Some time stable & some times in place Correct Choice : 2 From Lectuer # 15

www.vugujranwala.com

68 - Which may be a stable sort? 1. Merger 2. Insertion 3. Both above 4. None of the above Correct Choice : 3 From Lectuer # 15

www.vugujranwala.com

69 - Which of the following sorting algorithms is stable? (i) Merge sort, (ii) Quick sort, (iii) Heap sort, (iv) Counting Sort. 1. Only i 2. Only ii 3. Both i and ii 4. Both iii and iv Correct Choice : 1 From Lectuer # 15

www.vugujranwala.com

70 - Which of the following sorting algorithms is stable? (i) Merge sort, (ii) Quick sort, (iii) Heap sort, (iv) Counting Sort. 1. Only i 2. Only ii 3. Both i and ii 4. Both iii and iv Correct Choice : 1 From Lectuer # 15

www.vugujranwala.com

71 - Mergesort is a stable algorithm but not an in-place algorithm. 1. TRUE 2. FALSE 3. 4. Correct Choice : 1 From Lectuer # 16

www.vugujranwala.com

72 - Memorization is? 1. To store previous results for future use 2. To avoid this unnecessary repetitions by writing down the results of recursive

calls and looking them up again if we need them later 3. To make the process accurate 4. None of the above Correct Choice : 2 From Lectuer # 16

www.vugujranwala.com

73 - Dynamic programming algorithms need to store the results of intermediate sub-problems. 1. TRUE 2. FALSE 3. 4. Correct Choice : 1 From Lectuer # 17

www.vugujranwala.com

74 - Dynamic programming uses a top-down approach. 1. TRUE 2. FALSE 3. 4. Correct Choice : 2 From Lectuer # 17

www.vugujranwala.com

75 - The edit distance between FOOD and MONEY is 1. At most four 2. At least four 3. Exact four 4. Wrong Correct Choice : 1 From Lectuer # 17

www.vugujranwala.com

76 - The edit distance between FOOD and MONEY is 1. At most four 2. At least four 3. Exact four 4. Wrong Correct Choice : 1 From Lectuer # 17

www.vugujranwala.com

77 - If there are O (n^2) entries in edit distance matrix then the total running time is 1. O (1) 2. O (n^2) 3. O (n) 4. O (n log n) Correct Choice : 2 From Lectuer # 18

www.vugujranwala.com www.vugujranwala.com

79 - A p x q matrix A can be multiplied with a q x r matrix B. The result will be a p x r matrix C. There are (p . r) total entries in C and each takes _________ to compute. 1. O (q) 2. O (1) 3. O (n^2) 4. O (n^3) Correct Choice : 1 From Lectuer # 19

www.vugujranwala.com

80 - For Chain Matrix Multiplication we can not use divide and conquer approach because, 1. We do not know the optimum k 2. We use divide and conquer for sorting only 3. We can easily perform it in linear time 4. Size of data is not given Correct Choice : 1 From Lectuer # 19

www.vugujranwala.com www.vugujranwala.com

82 - A p x q matrix A can be multiplied with a q x r matrix B. The result will be a p x r matrix C. There are (p . r) total entries in C and each takes _________ to compute. 1. O (q) 2. O (1) 3. O (n^2) 4. O (n^3) Correct Choice : 1 From Lectuer # 19

www.vugujranwala.com

83 - The Knapsack problem belongs to the domain of _______________ problems. 1. Optimization 2. NP Complete 3. Linear Solution 4. Sorting Correct Choice : 1 From Lectuer # 21

www.vugujranwala.com

84 - Suppose we have three items as shown in the following table, and suppose the capacity of the knapsack is 50 i.e. W = 50. Item Value Weight 1 60 10 2 100 20 3 120 30 The optimal solution is to pick

www.vugujranwala.com

85 - Huffman algorithm uses a greedy approach to generate a postfix code T that minimizes the expected length B (T) of the encoded string. 1. TRUE 2. FALSE 3. 4. Correct Choice : 1 From Lectuer # 22

www.vugujranwala.com

86 - The codeword assigned to characters by the Huffman algorithm have the property that no codeword is the postfix of any other. 1. TRUE 2. FALSE 3. 4. Correct Choice : 2 From Lectuer # 22

www.vugujranwala.com

87 - The greedy part of the Huffman encoding algorithm is to first find two nodes with larger frequency. 1. TRUE 2. FALSE 3. 4. Correct Choice : 2 From Lectuer # 22

www.vugujranwala.com

88 - An optimization problem is one in which you want to find, 1. Not a solution 2. An algorithm 3. Good solution 4. The best solution

If a dynamic-programming problem satisfies the optimal-substructure property, then a locally optimal solution is globally optimal. If a greedy choice property satisfies the optimal-substructure property, then a locally optimal solution is globally optimal. Both of above None of above What general property of the list indicates that the graph has an isolated vertex? Select correct option: There is Null pointer at the end of list. The Isolated vertex is not handled in list. Only one value is entered in the list. There is at least one null list. Using ASCII standard the string abacdaacacwe will be encoded with __________ bits Select correct option: 64 128 96 120 Click here to Save Answer & Move to Next Question Quiz Start Time: 05:45 PM Time Left 13 sec(s) Question # 7 of 10 ( Start time: 05:49:48 PM ) Total Marks: 1 Suppose that a graph G = (V,E) is implemented using adjacency lists. What is the complexity of a breadth-first

traversal of G? Select correct option: O(|V |^2) O(|V | |E|) O(|V |^2|E|) O(|V | + |E|)

A digraph is strongly connected under what condition?

A digraph is strongly connected if for every pair of vertices u, v e V, u can reach v A digraph is strongly connected if for every pair of vertices u, v e V, u can reach v and vice versa. A digraph is strongly connected if for at least one pair of vertex u, v e V, u can reach v and vice versa. A digraph is strongly connected if at least one third pair of vertices u, v e V, u can reach v and vice versa

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

E V V+E V.E

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

Greedy Technique

What is the time complexity to extract a vertex from the priority queue in Prims algorithm?

log (V) v.v E.V log (E) Djkistra algorithm: Has greedy approach to find all shortest paths Has both greedy and Dynamic approach to find all shortest paths Has greedy approach to compute single source shortest paths to all other vertices Has both greedy and dynamic approach to compute single source shortest paths to all other vertices.

Top of Form

/wEPDwUKMTY2N

/wEWCgK3kf61Bw

Time Left Quiz Start Time: 06:56 PM Question # 1 of 10 ( Start time: 06:56:28 PM ) What is the time complexity to extract a vertex from the priority queue in Prims algorithm? Select correct option:

log (V)

84

sec(s)

Total Marks: 1

V.V

E.E

log (E)

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgKT24qzA

Time Left Quiz Start Time: 06:56 PM Question # 2 of 10 ( Start time: 06:56:41 PM ) What algorithm technique is used in the implementation of Kruskal solution for the MST? Select correct option:

Greedy Technique

86

sec(s)

Total Marks: 1

Divide-and-Conquer Technique

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgKUwezjA

Time Left Quiz Start Time: 06:56 PM Question # 3 of 10 ( Start time: 06:56:51 PM ) Which is true statement in the following. Select correct option:

Kruskal algorithm is multiple source technique for find

85

sec(s)

Total Marks: 1

Both of above

Kruskal's algorithm (choose best non-cycle edge) is b Tree edge) when the graph has relatively few edg

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgLH3on3D

Time Left Quiz Start Time: 06:56 PM Question # 4 of 10 ( Start time: 06:57:02 PM ) What is the time complexity to extract a vertex from the priority queue in Prims algorithm? Select correct option:

O (log E)

85

sec(s)

Total Marks: 1

? (V)

? (V+E)

O (log V)

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgKt3MieAw

Time Left Quiz Start Time: 06:56 PM Question # 5 of 10 ( Start time: 06:57:14 PM ) You have an adjacency list for G, what is the time complexity to compute Graph transpose G^T ? Select correct option:

(V+E)

87

sec(s)

Total Marks: 1

V.E

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgKP97SuD

Time Left Quiz Start Time: 06:56 PM Question # 6 of 10 ( Start time: 06:57:26 PM ) A digraph is strongly connected under what condition? Select correct option:

A digraph is strongly connected if for every pair of v

85

sec(s)

Total Marks: 1

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgLcp5/pAg

Time Left Quiz Start Time: 06:56 PM Question # 7 of 10 ( Start time: 06:57:37 PM ) The relationship between number of back edges and number of cycles in DFS is, Select correct option:

Both are equal

86

sec(s)

Total Marks: 1

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgKyocSoC

Time Left Quiz Start Time: 06:56 PM Question # 8 of 10 ( Start time: 06:57:47 PM ) You have an adjacency list for G, what is the time complexity to compute Graph transpose G^T.? Select correct option:

? (V + E)

86

sec(s)

Total Marks: 1

? (V E)

? (V)

? (V^2)

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgLXyo3VC

Time Left

39

sec(s)

Quiz Start Time: 06:56 PM Question # 9 of 10 ( Start time: 06:57:58 PM ) Dijkstras algorithm : Select correct option:

Has greedy approach to find all shortest paths

Total Marks: 1

Bottom of Form Top of Form

/wEPDwUKMTY2N /wEWCgLqzaeZBw

Time Left Quiz Start Time: 06:56 PM Question # 10 of 10 ( Start time: 06:58:57 PM ) There is relationship between number of back edges and number of cycles in DFS Select correct option:

Both are equal.

85

sec(s)

Total Marks: 1

Bottom of Form

Question No: 1 ( Marks: 1 ) - Please choose one Random access machine or RAM is a/an Machine build by Al-Khwarizmi Mechanical machine Electronics machine Mathematical model Question No: 2 ( Marks: 1 ) - Please choose one _______________ is a graphical representation of an algorithm notation notation Flowchart Asymptotic notation

Question No: 3 ( Marks: 1 ) - Please choose one A RAM is an idealized machine with ______________ random-access memory. 256MB 512MB an infinitely large 100GB Question No: 4 ( Marks: 1 ) - Please choose one What type of instructions Random Access Machine (RAM) can execute? Choose best answer Algebraic and logic Geometric and arithmetic Arithmetic and logic Parallel and recursive Question No: 5 ( Marks: 1 ) - Please choose one What will be the total number of max comparisons if we run brute-force maxima algorithm with n elements? 2 n

n 2 n n 8 n

Question No: 6 ( Marks: 1 ) - Please choose one What is the solution to the recurrence T(n) = T(n/2)+n . O(logn) O(n) O(nlogn) O(n2) Question No: 7 ( Marks: 1 ) - Please choose one Consider the following code: For(j=1; j<n;j++) For(k=1; k<15;k++) For(l=5; l<n; l++) { Do_something_constant(); } What is the order of execution for this code. O(n) O(n3) O(n2 log n)

Consider the following Algorithm: Factorial (n){ if (n=1) return 1 else return (n * Factorial(n-1)) { Recurrence for the following algorithm is:

T(n) = T(n-1) +1 T(n) = nT(n-1) +1 T(n)= T(n-1) +n T(n)=T(n(n-1)) +1 Question No: 9 ( Marks: 1 ) - Please choose one What is the total time to heapify? (log n) (n log n) (n2 log n) (log2 n) Question No: 10 ( Marks: 1 ) - Please choose one When we call heapify then at each level the comparison performed takes time It will take (1) Time will vary according to the nature of input data It can not be predicted It will take (log n) Question No: 11 ( Marks: 1 ) - Please choose one In Quick sort, we dont have the control over the sizes of recursive calls True False Less information to decide Either true or false Question No: 12 ( Marks: 1 ) - Please choose one Is it possible to sort without making comparisons? Yes No Question No: 13 ( Marks: 1 ) - Please choose one If there are (n2) entries in edit distance matrix then the total running time is (1) (n2)

(n) (n log n) Question No: 14 ( Marks: 1 ) - Please choose one For Chain Matrix Multiplication we can not use divide and conquer approach because, We do not know the optimum k We use divide and conquer for sorting only We can easily perform it in linear time Size of data is not given Question No: 15 ( Marks: 1 ) - Please choose one The Knapsack problem belongs to the domain of _______________ problems. Optimization NP Complete Linear Solution Sorting Question No: 16 ( Marks: 1 ) - Please choose one Suppose we have three items as shown in the following table, and suppose the capacity of the knapsack is 50 i.e. W = 50. Item Value Weight 1 60 10 2 100 20 3 120 30 The optimal solution is to pick Items 1 and 2 Items 1 and 3 Items 2 and 3 None of these

7:57 AM | Posted by Guru

In drawing a proper flowchart, all necessary steps that are a part of process should be listed out in ________________ order. Select correct option:

Physical

Random

Top to Bottom

Which of the following is a problem solving technique that re-assembles a systems components back into a complete system? Select correct option:

System analysis

System check

System configuration

The study of business problem domain is used to recommend improvements and specify the business requirements for the solution. Select correct option:

False

Which of the following may be of low fidelity and dismissed as toys? Select correct option:

Interfaces

Inference engines

Development engines

Which of the following refers to the structuring of hardware and software to achieve the effective and efficient processing of information? Select correct option:

SDLC

System monitoring

Operational planning

Which of the following allows manufacturers to rapidly and inexpensively test the parts of the design which are most likely to have problems? Select correct option:

Physical Model

Trial version

Carbon copy

Which of the following are knowledge workers who facilitate the development of information systems and computer applications by bridging the communications gap that exists between non-technical system users, and System designers and developers? Select correct option:

Software Engineers

System Designers

Chief Executives

Which of the following provides a structured means of addressing the impact of technologies on an organization? Select correct option:

Business planning

Requirements planning

Configuration planning

Employees might be unwilling to accept the high level of responsibility if organization is dominated by _____________and the culture is ____________. Select correct option:

Workers, autocratic

Computerized

Automated

Semi-computerized

Question # 1 of 10 ( Start time: 06:18:58 PM ) Total Marks: 1 We do sorting to, Select correct option: keep elements in random positions keep the algorithm run in linear order keep the algorithm run in (log n) order keep elements in increasing or decreasing order Question # 2 of 10 ( Start time: 06:19:38 PM ) Total Marks: 1 Heaps can be stored in arrays without using any pointers; this is due to the ____________ nature of the binary tree, Select correct option: left-complete right-complete tree nodes tree leaves Question # 3 of 10 ( Start time: 06:20:18 PM ) Total Marks: 1 Sieve Technique can be applied to selection problem? Select correct option: True False Question # 4 of 10 ( Start time: 06:21:10 PM ) Total Marks: 1 A heap is a left-complete binary tree that conforms to the ___________

Select correct option: increasing order only decreasing order only heap order (log n) order Question # 5 of 10 ( Start time: 06:21:39 PM ) Total Marks: 1 A (an) _________ is a left-complete binary tree that conforms to the heap order Select correct option: heap binary tree binary search tree array Question # 6 of 10 ( Start time: 06:22:04 PM ) Total Marks: 1 Divide-and-conquer as breaking the problem into a small number of Select correct option: pivot Sieve smaller sub problems Selection Question # 7 of 10 ( Start time: 06:22:40 PM ) Total Marks: 1 In Sieve Technique we do not know which item is of interest Select correct option: True False Question # 8 of 10 ( Start time: 06:23:26 PM ) Total Marks: 1 The recurrence relation of Tower of Hanoi is given below T(n)={1 if n=1 and 2T(n-1) if n >1 In order to move a tower of 5 rings from one peg to another, how many ring moves are required? Select correct option: 16 10

32 31 Question # 9 of 10 ( Start time: 06:24:44 PM ) Total Marks: 1 In the analysis of Selection algorithm, we eliminate a constant fraction of the array with each phase; we get the convergent _______________ series in the analysis, Select correct option: linear arithmetic geometric exponent Question # 10 of 10 ( Start time: 06:25:43 PM ) Total Marks: 1 For the heap sort, access to nodes involves simple _______________ operations. Select correct option: arithmetic binary algebraic logarithmic For the sieve technique we solve the problem, Select correct option: recursively mathematically precisely accurately The sieve technique works in ___________ as follows Select correct option: phases numbers integers routines Slow sorting algorithms run in, Select correct option: T(n^2) T(n) T( log n)

A (an) _________ is a left-complete binary tree that conforms to the heap order Select correct option: heap binary tree binary search tree array In the analysis of Selection algorithm, we eliminate a constant fraction of the array with each phase; we get the convergent _______________ series in the analysis, Select correct option: linear arithmetic geometric exponent In the analysis of Selection algorithm, we make a number of passes, in fact it could be as many as, Select correct option: T(n) T(n / 2) log n n/2+n/4 The sieve technique is a special case, where the number of sub problems is just Select correct option: 5 many 1 few In which order we can sort? Select correct option: increasing order only decreasing order only increasing order or decreasing order both at the same time The recurrence relation of Tower of Hanoi is given below T(n)={1 if n=1 and 2T(n-1) if n >1 In order to move a tower of 5 rings from one peg to another, how many ring moves are required?

Select correct option: 16 10 32 31 Analysis of Selection algorithm ends up with, Select correct option: T(n) T(1 / 1 + n) T(n / 2) T((n / 2) + n) We do sorting to, Select correct option: keep elements in random positions keep the algorithm run in linear order keep the algorithm run in (log n) order keep elements in increasing or decreasing order

Divide-and-conquer as breaking the problem into a small number of Select correct option: pivot Sieve smaller sub problems Selection The analysis of Selection algorithm shows the total running time is indeed ________in n, Select correct option: arithmetic geometric linear

orthogonal

How many elements do we eliminate in each time for the Analysis of Selection algorithm? Select correct option: n / 2 elements (n / 2) + n elements n / 4 elements 2 n elements

Sieve Technique can be applied to selection problem? Select correct option: True false For the heap sort we store the tree nodes in Select correct option: level-order traversal in-order traversal pre-order traversal post-order traversal

Make your own search before submit your own quiz This answers is just for idea -------------------------------------------------------------------------Quiz Start Time: 05:49 PM Time Left 84 sec(s)

Question # 1 of 10 ( Start time: 05:49:29 PM ) Total Marks: 1 Defining the services of an object means: Select correct option: What it does? What it knows? Who knows it? Whome it knows? -------------------------------------------------------------------------Quiz Start Time: 05:49 PM Time Left 90 sec(s) Question # 2 of 10 ( Start time: 05:50:56 PM ) Total Marks: 1 Identify the TRUE statement(s) Select correct option: An attribute that may have a number of values should be replaced by a new class and an object connection An attribute that varies over time, e.g., price of an item, should be replaced by an additional class with an effective date and value Replace yes/no type attributes with status type attributes for flexibility -------------------------------------------------------------------------Quiz Start Time: 05:49 PM Time Left 79 sec(s) Question # 5 of 10 ( Start time: 05:51:58 PM ) Total Marks: 1 Every object that you put in your object model should have some responsibility or role to play in the problem domain. Select correct option:

eagle_eye fantasy.fear@gmail.com

TRUE FALSE -------------------------------------------------------------------------Quiz Start Time: 05:49 PM Time Left 88 sec(s) Question # 6 of 10 ( Start time: 05:52:55 PM ) Total Marks: 1 Consider the following piece of code: public clas s Square extends Shape { // some code . } The above code is an example of: Select correct option: Part-Whole relationship Generalization/Specialization Data Sharing Data encapsulation --------------------------------------------------------------------------

Quiz Start Time: 05:49 PM Time Left 87 sec(s) Question # 7 of 10 ( Start time: 05:53:13 PM ) Total Marks: 1 A structure is a manner of organization which expresses a semantically strong organization within the problem domain. Select correct option: TRUE FALSE -------------------------------------------------------------------------Quiz Start Time: 05:49 PM Time Left 88 sec(s) Question # 9 of 10 ( Start time: 05:54:10 PM ) Total Marks: 1 "A car is made up of a body, three or four wheels, a steering mechanism, a breaking mechanism, and a power-engine" The above statement is example of: Select correct option: Whole-Part relationship Inheritance

eagle_eye fantasy.fear@gmail.com

Specialization Generalization -------------------------------------------------------------------------Quiz Start Time: 05:49 PM Time Left 88 sec(s) Question # 10 of 10 ( Start time: 05:55:34 PM ) Total Marks: 1 If Dog derives from Mammal, and Mammal derives from Animal, then: Select correct option: Dog inherits Animal's functions and data Dog does not inherit Animal's functions and data Mammal inherits functions and data of both Dog and Animal None of the given options -------------------------------------------------------------------------Quiz Start Time: 05:57 PM Time Left 89 sec(s) Question # 1 of 10 ( Start time: 05:57:08 PM ) Total Marks: 1 A structure is a manner of an organization which expresses a ________ strong organization within the problem domain. Select correct option: semantically syntactically graphically

none of the given -------------------------------------------------------------------------Quiz Start Time: 05:57 PM Time Left 89 sec(s) Question # 2 of 10 ( Start time: 05:57:48 PM ) Total Marks: 1

eagle_eye fantasy.fear@gmail.com

"A car is made up of a body, three or four wheels, a steering mechanism, a breaking mechanism, and a power-engine" The above statement is example of: Select correct option: Whole-Part relationship Inheritance Specialization Generalization -------------------------------------------------------------------------Quiz Start Time: 05:57 PM Time Left 88 sec(s) Question # 3 of 10 ( Start time: 05:58:12 PM ) Total Marks: 1 In "Railway ticket reservation system" the roles such as enquiry , reservation and ticketing and cancellation are to be performed by the user called :Select correct option: Passenger System analyst System developer System designer -------------------------------------------------------------------------Quiz Start Time: 05:57 PM Time Left 81 sec(s) Question # 4 of 10 ( Start time: 05:59:41 PM ) Total Marks: 1 Every object that you put in your object model should have some responsibility or role to play in the problem domain. Select correct option: TRUE FALSE -------------------------------------------------------------------------Quiz Start Time: 05:57 PM Time Left 87 sec(s) Question # 5 of 10 ( Start time: 06:00:14 PM ) Total Marks: 1

eagle_eye

fantasy.fear@gmail.com

Specialization means: Select correct option: Calling the same method with object of child object Hiding the data Creating new subclasses from an existing class None of given options -------------------------------------------------------------------------Quiz Start Time: 05:57 PM Time Left 87 sec(s) Question # 7 of 10 ( Start time: 06:01:52 PM ) Total Marks: 1 Ambiguity does not arise if requirements are not specified in clear terms Select correct option: TRUE FALSE -------------------------------------------------------------------------Quiz Start Time: 06:13 PM Time Left 83 sec(s) Question # 1 of 10 ( Start time: 06:14:00 PM ) Total Marks: 1 While establishing the services for an object, the following fundamental questions should be asked Select correct option: Why does the system need this object any way? What useful questions can it answer? What useful action can it perform? All of the given options -------------------------------------------------------------------------Quiz Start Time: 06:13 PM Time Left 87 sec(s)

eagle_eye fantasy.fear@gmail.com

Question # 3 of 10 ( Start time: 06:16:11 PM ) Total Marks: 1 ________ has become a standard notation for object oriented system modeling. Select correct option: UML C++ OCL (object Constraint Language) None of the given options MC090404410 : Tabish Ali Raza Quiz Start Time: 06:22 PM Time Left 86

sec(s) Question # 3 of 10 ( Start time: 06:23:35 PM ) Total Marks: 1 A cohesive Class is one which emphasizes on ____ unit of functionality Select correct option: Single Multiple Static None of the given options -------------------------------------------------------------------------Quiz Start Time: 06:30 PM Time Left 86 sec(s) Question # 1 of 10 ( Start time: 06:30:30 PM ) Total Marks: 1 ________ analysis educates the analyst on business domain complexity and shows a way to deal with it. Select correct option: Domain Use Case Object Collaboration None of the given options (not sure)

eagle_eye fantasy.fear@gmail.com

-------------------------------------------------------------------------Quiz Start Time: 06:30 PM Time Left 86 sec(s) Question # 7 of 10 ( Start time: 06:32:28 PM ) Total Marks: 1 The key objective(s) of OOD process should achieve the following: Select correct option: The class as far as possible should be Independent , but could be dependent on only a few classes. Interaction between two classes should be explicit. Class hierarchy should be built on specialization of higher class. All of the given options

CS 502

In drawing a proper flowchart, all necessary steps that are a part of process should be listed out in ________________ order. Select correct option: Logical Page No. 109 Physical Random Top to Bottom

Which of the following is a problem solving technique that re-assembles a systems components back into a complete system? Select correct option: System analysis System design Page No. 93 System check System configuration The study of business problem domain is used to recommend improvements and specify the business requirements for the solution. Select correct option: True Page No. 102 False Which of the following may be of low fidelity and dismissed as toys? Select correct option: Interfaces Inference engines Early prototypes Page No. 101 Development engines Which of the following refers to the structuring of hardware and software to achieve the effective and efficient processing of information? Select correct option: SDLC System monitoring Operational planning System development Page No. 78 Which of the following allows manufacturers to rapidly and inexpensively test the parts of the design which are most likely to have problems? Select correct option: Physical Model Prototype Page No. 100 Trial version Carbon copy Which of the following are knowledge workers who facilitate the development of information systems and computer applications by bridging the communications gap that exists between non-technical system users, and System designers and developers? Select correct option: System Analysts Page No. 103 Software Engineers System Designers Chief Executives Which of the following provides a structured means of addressing the impact of technologies on an organization?

Select correct option: Business planning IT planning Page No. 67 Requirements planning Configuration planning Employees might be unwilling to accept the high level of responsibility if organization is dominated by _____________and the culture is ____________. Select correct option: Workers, autocratic top management, autocratic Page No. 87 top management, democratic Middle level management, democratic In which of the following environments, duplication of clerical work is generally observed. Select correct option: Computerized Automated Manual Page No. 102 Semi-computerized

Q1

Total time for heapify is: ? (log2 n) ? (n log n) ? (n2 log n) ? (log n) Q2:_ If an algorithm has a complexity of log n + nlog n + n. we could say that it has complexity 1)O(n) 2)O( n log2

2 2

n)

3)O(3) 4)O( log ( log n )) 5)O ( log n) Q4 Due to left-complete nature of binary tree, heaps can be stored in Link list Structure Array None of above Q5 In selection algorithm, because we eliminate a constant fraction of the array with each phase, we get the

2 2 2

Q#6

In RAM model instructions are executed One after another Parallel Concurrent Random Qus 7 Consider the following pairs of functions I . f(x) = x + 3x+7 g(x) = x + 1022 II f(x) = x2log(x) g(x) = x3 III f(x) = x + log(3x +7) g(x) = (x48 2 +17x +3)2 Which of the pairs of functions f and g are asymptotic? ? Only I ? Only II ? Both I and III ? None of the above qus8 Execution of the following code fragment int Idx; for (Idx = 0; Idx < N; Idx++) { cout << A[Idx] << endl; } is best described as being ? O(N) ? O(N2) ? O(log N) ? O(N log N) qus9 If algorithm A has running time 7n2 + 2n + 3 and algorithm B has running time 2n2, then ? Both have same asymptotic time complexity ? A is asymptotically greater ? B is asymptotically greater ? None of others

Question No. 10

Which of the following sorting algorithms is stable? (i) Merge sort, (ii) Quick sort, (iii) Heap sort, (iv) Counting Sort. Counting sort and merge sort are stable ? Only i

? Only ii ? Both i and ii ? Both iii and iv qus11 Consider the following recurrence relation ? 2 if n = 0 T n( ) =? ? 6 (T n - 1) otherwise Then T(2) is ? 36 ? 72 ? 12 ? None of the above qus12 Let us say we have an algorithm that carries out N2 operations for an input of size N. Let us say that a computer takes 1 microsecond (1/1000000 second) to carry out one operation. How long does the algorithm run for an input of size 3000? ? 90 seconds ? 9 seconds ? 0.9 seconds ? 0.09 seconds qus13 The appropriate big ? classification of the given function. f(n) = 4n2 + 97n + 1000 is ? ? (n) ? ? (2n) ? ? (n2) ? ? (n2 log n) qus14 Consider the following polynomial

aknk+ak-1nk-1+.a0 .

What is the Big O representation of the above polynomial? ? O(kn) ? O(nk) ? O(nk+1) ? None of the above qus15

Consider the C++ program segment given below: for ( i=0 ; i < n; i++) { for (j = 1,sum=a[0]; j < = i; j++) Sum+=a[j]; Cout<< The sum for sub-array is<< sum;

Consider the following pairs of functions I . f(x) = (x3 + x2 + x + 1)4 g(x) = (x4 +x3 + x2+ x + 1)3 II f(x) = 22 g(x) = 2x 2 III f(x) = 2x + 3 g(x) = 2x + 7 IV f(x) = log(x2 + 1) g(x) = log( x) Which of the pairs of functions f and g are asymptotic? ? Only I ? Only III ? Both I and II ? Both III and IV

x

Question No. 5

Dynamic Programming uses top down approach with memorization Question No. 6

The edit distance between FOOD and MONEY is ? At most four ? At least four ? Exact four

Question No. 7

Consider the following recurrence relation ? 4 if n = 1 T n( ) =? Tn +2 n if n is divisible by 5 ? ( / 5) 3 Then T(5) is ? 25 ? 75 ? 79 ? None of the above

Questio

Compute the edit distance and edit scripts for the strings CRICKET and HOCKEY.

Question No. 9

Question No. 10

Execution of the following code fragment int i = N; while (i > 0) { int Sum = 0; int j; for (j = 0; j < N; j++) Sum++; cout << Sum << end; i--; } is best described as being ? O(N) ? O(N2) ? O(log N) ? O(N log N)

Question No. 11

It is impossible to design a sorting algorithm based on comparison of keys whose worstcase run time is in O(n). ? True ? False

Question No. 12

Consider the following recurrence relation ? 5 if n = 1 T n( ) =? + if n is even ? 2 ( / 2) 3 Then T(8) is ? 61 ? 29 ? 13 ? None of the above

Question No. 13

The merge sort algorithm involves the following steps. (i) Recursively sort the 1st and 2nd halves separately (ii) Merge the two-sorted halves into a sorted group. (iii) If the number of items to sort is 0 or 1, return. Which is the correct order of instructions in merge sort algorithm? ? (i),(ii),(iii) ? (ii),(iii),(i) ? (iii),(ii),(i) ? (iii),(i),(ii) qus14

iterfib achieve an exponential speedup over the original recursive algorithm True False

In Max Heap, node i/2 > node i In Min Heap, node i/2 < node i Edit Distance: The edit distance of two strings, s1 and s2, is defined as the minimum number of changes required to change string s1 into string s2, where a change is one of the following: Substitute (change) a letter, Insert a letter or Delete a letter Knapsack Problem is that, We have to fill a bag that can carry maximum weight W We have to fill the bag with different items each having a certain weight and value We want to fill the bag with these items such that total value of items present in bag is maximum and total weight of items doesnt increase maximum weight that bag can carry(W). this knapsack problem belongs to the domain of optimization problems An optimization problem is one in which you want to find, not just a solution, but the best solution The problem is called a 0-1 problem, because each item must be entirely accepted or rejected. 1. Simple Sub problems: We should be able to break the original problem to smaller sub problems that have the same structure 2. Principle of Optimality: Recursively define the value of an optimal solution. Express the solution of the original problem in terms of optimal solutions for smaller problems. 3. Bottom-up computation: Compute the value of an optimal solution in a bottom-up fashion by using a table structure. 4. Construction of optimal solution: Construct an optimal solution from computed information. How an optimal solution is constructed for knapsack algorithm Constructing the Optimal Solution The algorithm for computing V[i, j] does not keep record of which subset of items gives

the optimal solution. To compute the actual subset, we can add an auxiliary Boolean array keep[i, j] which is 1 if we decide to take the ith item and 0 otherwise. We will use all the values keep[i, j] to determine the optimal subset T of items to put in the knapsack define an optimal value:_ The minimum (or maximum) value of the

Original recursive algorithm takes theta phi ki power n that is 1.618. The analysis of Selection algorithm shows the total running time is indeed ________in n (linear) 3. The sieve technique works in ___________ as follows (phases) how to fill the edit distance table???

Fill first row and first column in increasing order as filled in handouts. Now fill the cells with one of these four values (which one is least), If cell is (i,j) where i = row no, and j = column no Then its value will be one of these values, Value of cell (i-1,j) [immediate above cell] + 1 Value of cell (i,j-1) [immediate left cell] +1 Value of cell (i-1,j-1) [left diagonal cell] +1 if characters for that cell do not match Value of cell (i-1,j-1) [left diagonal cell] if characters for that cell match

1) Business model is the part of designing phase of software engineering development life cycle ? True ? False 2) The state transition diagram ? depicts relationships between data objects ? depicts functions that transform the data flow ? indicates how data are transformed by the system ? indicates system reactions to external events 3) The best way to conduct a requirements validation review is to ? Examine the system ? Have the customer look over the requirements ? Send them to the design team ? Use checklist to examine the questions 4) The system specification describes the ? Function, performance and constraints of a computer-based system ? implementation of each allocated system ? time required for simulation ? element software architecture 5) For each of the following given Requirement indicate whether it is Functional (F) or

NonFunctional (N) Requirement. [2 marks each] 1. The System should be designed so it can later be extended to a Blue Line reservation System.(N) 2. The System will allow the user to view the layout of seats in Bus.(F) 3. The System must be available at all times.(N) 4. A given seat can be assigned to only one person.(F) 6)Both the software engineer and customer take an active role in software requirements engineering-a set of activities that is often referred to as Requirement_______________ ? Managing ? Recognition ? Analysis ? Modeling _________ is a measure of independence of a module or component. ? Cohesion ? Coupling

7) In the Functional design, the structure of the system revolves around __________ ? Functions ? Sequences ? Models ? Flows 8)Use case is the part of designing phase of software engineering ? True ? False 9) Three categories of risks are ? Business, personnel risks, budget risks ? project risks, technical risks, business risks ?planning risks, technical risks, personnel risks ? management risks, technical risks, design risks Fibonacci sequence 2mark

2mark

3marks

Heapify proof.....

5marks

Dijkstra Algorithmn

5marks

3marks

DFS algoritmn

3marks

algo_mcq_compiled.doc C:\Users\Memoona\Documents

C:\Users\Memoona\AppData\Roaming\Microsoft\Templates\Norm al.dotm Title: 1 Subject: Author: dcs Keywords: Comments: Creation Date: 8/22/2010 7:06:00 AM Change Number: 29 Last Saved On: 2/20/2011 10:04:00 PM Last Saved By: Memoona Total Editing Time: 225 Minutes Last Printed On: 2/20/2011 10:06:00 PM As of Last Complete Printing Number of Pages: 115 Number of Words: 19,511 (approx.) Number of Characters: 111,218 (approx.)

- Chess as Graph TheoryUploaded bymitxael83
- Cs502 Collection of Old PapersUploaded bycs619finalproject.com
- Algo Mcq CompiledUploaded bysny2ksa
- CS604 Quizzes SolvedUploaded byPower Girls
- Greedy And DFS In Huffman CodingUploaded byRaydhitya Yoseph
- Cs614 Collection of Old PapersUploaded bycs619finalproject.com
- CS502_allUploaded byrung_baaz
- Algorithm Question SetUploaded bylokenders801
- Dijkstra’s Algorithm Shortest PathUploaded byhanhnd_54
- EteUploaded byDavor Profesor
- GraphTheoryUploaded byMohd Hilmi
- Spanning TreesUploaded byIrinaIliuţă
- Chapter8 DeadlocksUploaded byMohammed Al-sadi
- Comb SortingUploaded byAliRahman
- Tree Data StructureUploaded byTanmay Baranwal
- Leamer%20M.J.%20Groebner%20finite%20path%20algebras%20(M.S.%.pdfUploaded byTina Tinutza
- Merge SortUploaded byGaurav Tolani
- Insertion Sort Bubble Sort Selection SortUploaded byPradyumna Nahak
- MST.ppt_0Uploaded byChandan Choudhury
- 3-floydUploaded byNguyenDo
- Math HW Oct 28Uploaded byQuinnNgo
- Meidan Filter DocUploaded bytrungkiendt9
- The Uniform Spanning Tree and Related ModelsUploaded byalurana
- s5.psUploaded byGrant Lin
- AxialGen.pdfUploaded bysarabiba1971
- Clique PolynomialUploaded byint91h
- Lecture 1(Fundamental of Algorithms)Uploaded byavinash
- [2011] Data StructuresUploaded byMd Isfaque
- Cs301 SolutionUploaded byMuhammad Usman
- t05Uploaded byfsvvdfhf

- LADDER AND SUBDIVISION OF LADDER GRAPHS WITH PENDANT EDGES ARE ODD GRACEFULUploaded byMegan Bell
- Grade 7 Math AssessmentUploaded byjriver64
- Triple Connected Domination Number of a Bipolar Fuzzy GraphUploaded byIJRASETPublications
- Topology Based Data Analysis Identifies a Subgroup of Breast Cancer With a Unique Mutational Profile and Excellent SurvivalUploaded byLuis Morales
- Boost Con 2010 BglUploaded byXavier Girona Barcelona
- Planar Graphs.pptUploaded bysjo05
- 3 DFS - Algorithms (series lecture)Uploaded byturjo987
- Graph based framework for designing Modern Decision Support SystemsUploaded byAnonymous vQrJlEN
- Antony Term Paper-3Uploaded byAntony Puthussery P
- Prims AlgorithmUploaded bytigersayooj
- The collaboration network of the Brazilian Symposium on DatabasesUploaded byAlefe
- cumc2015program.pdfUploaded byMichael Yu
- 05 quadratics - graphing the parent function 1Uploaded byapi-270891801
- ex10Uploaded byArockiaruby Ruby
- Network Traffic Analysis by Bipartite Graph and One mode ProjectionUploaded byIRJET Journal
- Split and Non Split Neighborhood Connected Domination in Fuzzy GraphsUploaded byIRJET Journal
- Boland DumitrescuUploaded byLeonardo Jacobina
- 487-547-1-PB.pdfUploaded byJacob Huston
- csom_phdthesisUploaded byhosseinr13
- Data StructrUploaded byJaimon Jacob
- Agent grUploaded byPhạmTrungKiên
- 7 GraphUploaded byirinarm
- Thomas Lengauer Auth. Combinatorial AlgorithmUploaded byAdam Leach
- Pseudoflow New Life for Lerchs-GrossmannUploaded byEfrain Mosqueyra
- Chapter 10Uploaded byBobDover
- Plant Layout(Hospital) (Operations management)Uploaded byRifat Rejuan Mithun
- lnotes.pdfUploaded byParveen Dagar
- Graph Problems ShuffledUploaded byrappycat
- skillset.xlsUploaded byTavishi Singh
- 10.1038@nature23268Uploaded byAnonymous 4F2bux