Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

DAA Questions and Objective

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

www.android.universityupdates.in | www.universityupdates.in | https://telegram.

me/jntuh

QUESTION BANK: (JNTUH)


Blooms
Course
S. No Question Taxonomy
Outcomes
Level
UNIT – I
PART – A (SHORT ANSWER QUESTIONS)
Define the term algorithm and state the criteria the algorithm
1 Knowledge 1
should satisfy.
2 Compute the average case time complexity of quick sort Apply 1
Describe the role of space complexity and time complexity of
3 Knowledge 1
a program?
4 If f(n)=5n2+ 6n + 4, then prove that f(n) is O(n2) Apply 4
What is meant by divide and conquer? Give the recurrence
5 Understand 1
relation for divide and conquer.
PART – B (LONGANSWER QUESTIONS)
1 Write binary search algorithm and analyze its time complexity Understand 1
Explain quick sort algorithm and simulate it for the following
2
data 20, 5,10,16 ,54 ,21 Apply 1
3 Illustrate merge sort algorithm and discuss time complexity Understand 2
4 Describe strassen’s matrix multiplication. Understand 2
Sort the list of numbers using merge sort: 78, 32, 42, 62, 98,
5
12, 34, 83 Apply 1

Blooms
Course
S. No Question Taxonomy
Outcomes
Level
UNIT – II

PART – A (SHORT ANSWER QUESTIONS)


1 Discuss about union operation on sets Knowledge 2
2 Describe AND/OR graph Understand 2
3 Explain game tree Understand 3
4 Define a connected and bi-connected component. Knowledge 2
5 Define an articulation point? Knowledge 2

PART – B (LONGANSWER QUESTIONS)

1 Discuss N-queens problem and algorithm Understand 2


Discuss about weighting rule for finding UNION of sets and
2
collapsing rule Understand 2
3 Differentiate divide and conquer and greedy method Understand 2
4 Discuss Graph coloring problem Understand 2
5 Compare and contrast BFS and DFS. Analyze 2

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntuh


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntuh

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

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntuh


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntuh

5 Discuss all pairs shortest path problem with an example Understand 4

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

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntuh


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntuh

Ans :Breadth first


7. The Knapsack problem where the objective function is to minimize the profit is______
(a) Greedy (b) Dynamic 0 / 1 (c) Back tracking (d) Branch & Bound 0/1
Ans :Branch& Bound 0/1
8. Choose the correct answer for the following statements:
I. The theory of NP–completeness provides a method of obtaining a polynomial time
for NPalgorithms.
II. All NP-complete problem are NP-Hard.
(a) I is FALSE and II is TRUE (b) I is TRUE and II is FALSE (c) Both are TRUE (d) Both
are FALSE
Ans :I is FALSE and II is TRUE
9. If all c(i, j )’s and r(i, j)’s are calculated, then OBST algorithm in worst case takes one of
the following time.
(a) O(n log n) (b) O(n3) (c) O(n2) (d) O(log n) (e) O(n4).
Ans : O(n3)
10. The upper bound on the time complexity of the nondeterministic sorting algorithm is
(a) O(n) (b) O(n log n) (c) O(1) (d) O( log n) (e) O(n2).
Ans: O(n)

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

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntuh


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntuh

8.Greedy job scheduling with deadlines algorithms’ complexity is defined as


(a) O(N) (b) Ω( n log n) (c) O (n2 log n) (d) O ( n log n)
Ans: O(N)
9. From the following choose the one which belongs to the algorithm paradigm other than to
which others from the following belongs to.
(a) Minimum & Maximum problem (b) Knapsack problem (c) Selection problem (d) Merge
sort
Ans : Knapsack problem
UNIT-III
1. From the following pick the one which does not belongs to the same paradigm to which
others belongs to.
(a) Minimum & Maximum problem (b) Knapsack problem
(c) Selection problem (d) Merge sort
Ans:Knapsack problem
2. Primsalgorithm is based on _____________ method
a. Divide and conquer method c. Dynamic programming
b. Greedy method d. Branch and bound
Ans. Greedy Method
3. The amount of memory needs to run to completion is known as_____________
a. Space complexity c. Worst case
b. Time complexity d. Best case
Ans: Space complexity
4. The amount of time needs to run to completion is known as____________
a. Space complexity c. Worst case
b. Time complexity d. Best case
Ans: Time complexity
5. __________ is the minimum number of steps that can executed for the given parameters
a. Average case c. Worst case
b. Time complexity d. Best case
Ans: Best case
6. __________ is the maximum number of steps that can executed for the given parameters
a. Average case c. Worst case
b. Time complexity d. Best case
Ans:Worst case
7. __________ is the average number of steps that can executed for the given parameters
a. Average case c. Worst case
b. Time complexity d. Best case
Ans: Average Case
8. Testing of a program consists of 2 phases which are ______________________and
____________
a. Average case & Worst case b. Time complexity & Space complexity
c. Validation and checking errors d. Debugging and profiling
Ans: Debugging and profiling
9. Worst case time complexity of binary search is ______________
a. O(n) b. O(logn)c. Ɵ(nlogn) d. Ɵ(logn)
Ans: Ɵ(logn)
10. Best case time complexity of binary search is ______________
a. O(n) c. Ɵ(nlogn)b. O(logn) d. Ɵ(logn)
Ans: Ɵ(logn)

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntuh


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntuh

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

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntuh


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntuh

a. greedy method c. branch and bound


b. dynamic programming d. divide and conquer
Ans. Greedy method
3. 0/1 knapsack is based on ____________method
a. greedy method c. branch and bound
b. dynamic programming d. divide and conquer
Ans. Dynamic programming
4. The files x1,x2,x3 are 3 files of length 30,20,10 records each. What is the optimal
merge pattern value?
a. 110 c. 60
b. 90 d. 50
Ans. 90
5. The optimal merge pattern is based on _________ method
a. Greedy method b. Dynamic programming
c. Knapsack method d. Branch and bound
Ans. Greedy method
6. Who invented the word Algorithm
a. Abu Ja’far Mohammed ibn Musa c. Abu Mohammed Khan
b. Abu Jafar Mohammed Kasim d. Abu Ja’far Mohammed Ali Khan
Ans. Abu Ja’far Mohammed ibn Musa
7. In Algorithm comments begin with____________
a. /* c. /
b. */ d. //
Ans : //
8. The ___________ of an algorithm is the amount of memory it needs to run to
completion.
a. Space Complexity c. Best Case
b. Time Complexity d. Worst Case
Ans : Space Complexity
9. ___________ is the process of executing a correct program on data sets and
measuring the time and space it takes tocompute the results.
a. Debugging c. Combining
b. Profiling d. Conqure
Ans : Profiling
10. In Algorithm Specification the blockes are indicated with matching _______
a. Braces c. Square Brackets
b. Parenthesis d. Slashes
Ans : Braces

FILL IN THE BLANKS

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?

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntuh


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntuh

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)

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntuh


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntuh

5. Best case time complexity of Quick sort is ______________


Ans : O(nlogn)
6. Average case time complexity of Quick sort is ______________
Ans : O(nlogn)
7. Which design strategy stops theexecution when it find the solution otherwise starts the
problem from top
Ans: Back Tracking
8. Graphical representation of algorithm is _____________________
Ans: Flow Chart
9. In pseudo-code conventions input express as __________
Ans : Write
10. In pseudo-code conventions output express as __________
Ans : Read

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

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntuh


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntuh

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

XI. GATE QUESTIONS:


1. The order of an internal node in a B+ tree index is the maximum number of children it can
have. Suppose that a child pointer takes 6 bytes, the search field value takes 14 bytes, and
the block size is 512 bytes. What is the order of the internal node?
A) 24B) 25C) 26D) 27
Answer : (C)
2 The best data structure to check whether an arithmetic expression has balanced parentheses
is a
A) queue B) stack C) tree D) list
Answer : (B)
3. 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)

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntuh


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntuh

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)

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntuh

You might also like