DAA Questions and Objective
DAA Questions and Objective
DAA Questions and Objective
me/jntuh
Blooms
Course
S. No Question Taxonomy
Outcomes
Level
UNIT – II
Blooms
Taxon Course
S. No Question
omy Outcomes
Level
UNIT – III
PART – A (SHORT ANSWER QUESTIONS)
1 Define greedy method Know edge 3
2 State Prim’s algorithm Knowledge 3
3 What is job sequencing with deadlines problem Know edge 3
4 State the principle of optimality Know edge 3
5 Define minimum cost spanning tree Know edge 3
PART – B (LONGANSWER QUESTIONS)
1 Discuss single source shortest path problem with example Apply 3
2 Discuss kruskal’s algorithm with an example Understand 3
3 Write an algorithm knapsack problem .Give example Apply 3
4 Explain prims algorithm with an example Understand 3
Compute the optimal solution for knapsack problem using
5 greedy method N=3,
M= 20, (p1,p2,p3)= (25,24,15), (w1,w2,w3) =(18,15,10) Apply 3
Blooms
Course
S.No Question Taxonomy
Outcomes
Level
UNIT – IV
PART – A (SHORT ANSWER QUESTIONS)
Write an algorithm for optimal binary search tree Give
1
example Apply 4
2 Explain 0/1 knapsack problem with example Understand 4
3 Discuss all pairs shortest path problem with an example Understand 4
Explain 8 – Queens
4
problem Understand 4
5 Define Sum of Subsets problem Understand 4
PART – B (LONGANSWER QUESTIONS)
Describe the travelling salesman problem and discuss
1
how to solve it using dynamic programming? Understand 4
2 Explain the concept Chained matrix multiplication. Apply 4
Solve the solution for 0/1 knapsack problem using
dynamic programming(p1,p2,p3, p4) = (11, 21, 31,
3
33), (w1, w2, w3, w4) = (2, 11, 22, 15), M=40, n=4
Apply 4
Use optimal binary search tree algorithm and
compute wij, cij, rij, 0<=i<=j<=4,p1=1/10, p2=1/5,
4 p3=1/10, p4=1/120, q0=1/5, q1=1/10, q2=1/5,
q3=1/20,q4=1/20.
Apply 3
Blooms
Course
S.No Question Taxonomy
Outcomes
Level
UNIT – V
PART – A (SHORT ANSWER QUESTIONS)
1 Define a dead node Knowledge 5
2 Differentiate live node and dead node Knowledge 5
3 Compare NP-hard and NP-completeness Knowledge 5
4 Define deterministic problem Understand 5
5 Define maxclique problem? Understand 5
PART – B (LONG ANSWER QUESTIONS)
1 Explain the principle of FIFO branch and bound Apply 5
Explain the method of reduction to solve travelling sales
2
person problem using branch and bound Apply 5
3 Write non deterministic algorithm for sorting and searching Understand 5
What is chromatic number decision problem and clique
4
decision problem Apply 5
5 Explain Cook’s theorem Apply 5
X. OBJECTIVE QUESTIONS
MULTIPLE CHOICE QUESTIONS
UNIT-I
1. In analysis of algorithm, approximate relationship between the size of the job and the
amount of work required to do is expressed by using _________
(a) Central tendency (b) Differential equation (c) Order of execution (d) Order of magnitude
(e) Order of Storage.
Ans :Order of execution
2. Worst case efficiency of binary search is
(a) log2 n + 1 (b) n (c) N2 (d) 2n (e) log n.
Ans : log2 n + 1
3. For analyzing an algorithm, which is better computing time?
(a)O (100 Log N) (b) O (N) (c)O (2N) (d) O (N logN) (e) O (N2).
Ans :O (100 Log N)
4. Consider the usual algorithm for determining whether a sequence of parentheses is
balanced. What is the maximum number of parentheses that will appear on the stack AT
ANY ONE TIME when the algorithm analyzes: (()(())(()))
(a) 1 (b)2 (c)3 (d) 4
Ans :3
5. Breadth first search __________
(a) Scans each incident node along with its children. (b) Scans all incident edges before
moving to other node.(c) Issame as backtracking (d) Scans all the nodes in random order.
Ans :Scans all incident edges before moving to other node.
6. Which method of traversal does not use stack to hold nodes that are waiting to be
processed?
(a) Dept First (b) D-search (c)Breadth first (d) Back-tracking
UNIT-II
1. Name the node which has been generated but none of its children nodes have
been generated in state space tree of backtracking method.
(a) Dead node (b) Live node (c) E-Node (d) State Node
Ans: Livenode
2. How many nodes are there in a full state space tree with n = 6?
(a) 65 (b) 64 (c) 63 (d) 32
Ans : 63
3. This algorithm scans the list by swapping the entries whenever pair of adjacent keys are
out of desired order.
(a) Insertion sort. (b) Bubble sort. (c) Shell sort. (d) Quick sort.
Ans: Bubble sort.
4. From the following chose the one which belongs to the algorithm paradigm other than to
which others from the following belongs to.
(a) Minimum & Maximum problem. (b) Knapsack problem. (c) Selection problem.(d)
Merge sort.
Ans: Knapsack problem.
5. To calculatec(i, j )’s, w( i, j)’s and r(i, j)’s; the OBST algorithm in worst case takes the
following time.
(a) O(log n) (b) O (n4) (c) O (n3) (d) O (n log n)
Ans: O (n3)
6. What is the type of the algorithm used in solving the 4 Queens problem?
(a) Greedy (b) Dynamic (c) Branch and Bound (d) Backtracking.
Ans: Backtracking.
7.In Knapsack problem, the best strategy to get the optimal solution, where Pi, Wi is the
Profit, Weight associated with each of the Xi h object respectively is to
(a) Arrange the values Pi/Wi in ascending order (b) Arrange the values Pi/Xi in
ascending order
(c) Arrange the values Pi/Wi in descending order (d) Arrange the values Pi/Xi in
descending order
Ans: Arrange the values Pi/Xi in descending order
UNIT-IV
1. Tight bound is denoted as _______
a. Ω c. Θ
b. Ω d. O
Ans : Θ
2. Upper bound is denoted as _______
a. Ω c. Θ
b. ω d. O
Ans : O
3. lower bound is denoted as _______
a. Ω c. Θ
b. ω d. O
Ans :Ω
4. The function f(n)=o(g(n)) if and only if Limit f(n)/g(n)=0n->∞
a. Little oh b. Little omega
b. Big oh d. Omega
Ans : Little oh
5. The functionf(n)=o(g(n)) if and only if Limit g(n)/f(n)=0 n->∞
a. Little oh b. Little omega
b. Big oh d. Omega
Ans : Little omega
6. Thegeneralcriteriaofalgorithm;zero or more quantities are externally supplied is______
a. Output b. Finiteness
b. Effectiveness d. Input
Ans : Input
7. The general criteria of algorithm; at least one quantity is produced ______
a. Output b. Finiteness
b. Effectiveness d. Input
Ans : Output
8. The general criteria of algorithm; Each instruction is clear and unambiguous ______
a. Output b. Definiteness
b. Effectiveness d. Input
Ans : Definiteness
9. The general criteria of algorithm; algorithm must terminates after a finite number
of steps ______
a. Output b. Finiteness
b. Effectiveness d. Input
Ans : Finiteness
10. Which is not a criteria of algorithm
a. Input b. Output
b. Time complexity d. Best case
Ans : Best case
UNIT-V
1. job sequencing with deadline is based on ____________method
a. greedy method c. branch and bound
b. dynamic programming d. divide and conquer
Ans. Greedy method
2. fractional knapsack is based on ____________method
UNIT-I
1. The worst case time complexity of the nondeterministic dynamic knapsack algorithm is
___
Ans :O(n)
2. Recursive algorithms are based on______________ approach
Ans :Bottom-up approach
3. What do you call the selected keys in the quick sort method_____________
Ans : Pivot key
4. How do you determine the cost of a spanning tree?
Ans :By the sum of the costs of the edges of the tree8.
5. The time complexity of the normal quick sort, randomized quick sort algorithms in the
worst case is ______________
Ans :O(n2), O(n2)
6. Let there be an array of length ‘N’, and the selection sort algorithm is used to sort it, how
many times a swap function is called to complete the execution?
Ans :N-1 times
7. The Sorting methodwhich is used for external sort is _________________
Ans :Radix sort
8. The graph colouringalgorithm’s time can be bounded by _________
Ans :O(nmn).
9. Sorting is not possible by using ____________ methods?
(a) Insertion (b) Selection (c) Deletion (d) Exchange
Ans :Deletion
10. What is the type of the algorithm used in solving the 8 Queens problem?
Ans :Backtracking
UNIT-II
1. Identify the name of the sorting in which time is not proportional to n2.
(a) Selection sort (b) Bubble sort (c) Quick sort (d) Insertion sort.
Ans : Insertion sort
2. The optimal solution to a problem is a combination of optimal solutions to its
subproblems. This is known as
. Ans : Principle of Optimality
3. Which of the following versions of merge sort algorithm does use space efficiently?
(a) Contiguous version (b) Array version (c) Linked version (d) Structure
version (e) Heap version.
Ans : Linked version
4. Identify the correct problem for multistage graph from the list given below.
(a) Resource allocation problem (b) Traveling salesperson problem
(c) Producer consumer problem (d) Barber’s problem
Ans : Resource allocation problem
5. How many edges are there in a Hamiltonian cycle if the edge cost is ‘c’ and the cost of
cycle is ‘cn’
Ans :n.
6. A problem L is NP-complete iff L is NP-hard and
Ans : L ε NP
7. What would be the cost value for any answering node of a sub tree with root ‘r’ using
branch-bound algorithm?
Ans: Minimum
UNIT-III
1. Average case time complexity of binary search is ______________
Ans: Ɵ(logn)
2. Merge sort invented by _____________
Ans : JOHN VON NEUMANN
3. Quick sort invented by _____________
Ans : CARHOARE
4. Worst case time complexity of Quick sort is ______________
Ans : O(n2)
UNIT-IV
1. Which is not in general criteria of algorithm
a. Input b. Output
b. Time complexity d. Effectiveness
Ans : Time complexity
2. Time complexity of given algorithm is ________________
Algorithm Display(A)
{
S:=0.0;
For i:=0 to n-1
{
S:=S+A[i];
Return S;
}
}
Ans : 4n+4
3. Time complexity of given algorithm
AlgorithmSum(A,S)
{
for i:=1 to n-1
{
for j:=2 to n-1
{
S:=S+i+j;
return S;
}
}
}
Ans :6n2-14n+10
4. kruskal algorithm is based on ___________method
Ans. Greedy method
5. Prims algorithm is based on _____________ method
Ans. Greedy Method
6. The output of Kruskal and Prims algorithm is ________________
Minimum cost spanning tree
UNIT-V
1. Huffmancodes are the applications of _________ with minimal weighted external
path length obtained by an optimal set.
Ans : Binary tree
2. From the following which is not return optimal solution
a. Dynamic programming c. Backtracking
b. Branch and bound d. Greedy method
Ans. Backtracking
3. ____________ is an algorithm design method that can be used when the solution
to a problem can be viewed as the result of a sequence of decisions
Ans : Dynamic programming
4. The name backtrack was first coined by _________
Ans :D.H.Lehmer
5. The term ________ refers to all state space search methods in which all hildren of the –
nodes are generated before any other live node can becomethe E-node.
Ans ; Branch and Bound
6. A __________ is a round trip path along n edges of G that visits every vertex once
and returns to its starting position.
Ans :Hamiltonian Cycle
7. Graph Coloring is __________ type of algorithm design strategy
Ans : Backtracking
8. Which of the following is not a limitation of binary search algorithm?
a. must use a sorted array
b. requirement of sorted array is expensive when a lot of insertion and deletions
are needed
c. there must be a mechanism to access middle element directly
d. binary search algorithm is not efficient when the data elements are more than 1000.
Ans : binary search algorithm is not efficient when the data elements are more than
1000.
9. Binary Search Algorithm cannot be applied to ___________________
Ans :Sorted linked list
10. Two main measures for the efficiency of an algorithm are
Ans : Time and Space
4 The following numbers are inserted into an empty binary search tree in the given order:
10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree (the height is the
maximum distance of a leaf node from the root)?
A) 2B) 3C) 4D) 6
Answer : (B)
5 The goal of structured programming is to
A) have well indented programs B) be able to infer the flow of control from the compiled
Code C) be able to infer the flow of control from the program text D) avoid the use of GOTO
statements
Answer : (C)
6 The tightest lower bound on the number of comparisons, in the worst ease, for
comparison-based sorting is of the order of
A) nB) n 2C) n log n D) n log2 n
Answer : (B)
7 Let G be a simple graph with 20 vertices and 100 edges. The size of the minimum vertex
cover of G is 8. Then, the size of the maximum independent set of G is
A) 12 B) 8 C) Less than 8 D) More than 12
Answer : (A)
8 Let A be a sequence of 8 distinct integers sorted in ascending order. How many distinct
pairs of sequences, B and C are there such that (i) each is sorted in ascending order, (ii) B
has 5 and C has 3 elements, and (iii) the result of merging B and C gives A?
A) 2B) 30C) 56D) 256
Answer : (D)
9 A Priority-Queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-
order traversal of the heap is given below: 10, 8,5,3,2 Two new elements 1 and 7 are
inserted in the heap in that order. The level-order traversal of the heap after the insertion of
the elements is
A) 10,8,7,5,3,2,1B) 10,8,7,2,3,1,5C) 10,8,7,1,2,3,5D) 10,8,7,3,2,1,5
Answer : (D)
10 The S-N curve for steel becomes asymptotic nearly at
A) 103 cycles B) 104cyclesC) 10 6 cycles D) 10 9 cycles
Answer : (C)