NEW
Font size
WorksheetsDAA IA2 Test 50 1 marks , 25 2 marks total 100
Total questions: 75
Worksheet time: 2hrs 38mins
You are running a library catalog. You know that the books in your collection are almost in sorted ascending order by title, with the exception of one book which is in the wrong place. You want the catalog to be completely sorted in ascending order.
Insertion Sort
Merge Sort
Radix Sort
Heap Sort
Counting Sort
Which of the following sorting methods would be most suitable for sorting a list which is almost sorted?
Bubble Sort
Insertion Sort
Binary Sort
Quick Sort
What is the time complexity of the above recursive implementation used to reverse a string?
O(1)
O(n)
O(n2)
O(n3)
How many recursive calls are there in Recursive matrix multiplication by Strassen’s Method?
5
7
8
4
Which of the following statement is true about stack?
Pop operation removes the top most
element
Pop operation removes the bottom most
element
Push operation adds new element at the
bottom
Push operation removes the top most
element
Which of the following is considered as the top of the stack in the linked list implementation of the stack?
Last node
First node
Random node
Middle node
Which of the following is the biggest advantage of selection sort?
It has low time complexity
it has low space complexity
it is easy to implement
it requires only n swaps under any condition
Recursive selection sort is a comparison based sort.
True
False
Which of the following sorting algorithm is NOT stable?
Selection Sort
Bubble Sort
Brick Sort
Merge Sort
What is the number of swaps required to sort the array arr={5,3,2,4,1} using recursive selection sort?
0
1
2
3
Which of the following lines should be inserted to complete the above code?
arr[i] > max_element
arr[i] < max_element
arr[i] == max_element
arr[i] != max_element
Which of the following techniques can be used to search an element in an unsorted array?
Iterative linear search
Recursive binary search
Iterative binary search
Normal Binary Search
Which of the following lines should be inserted to complete the above code?
temp = next
temp->next = temp
temp = temp->next
return 0
Which of the following lines should be inserted to complete the above code?
1
0
linear_search(temp, value)
linear_search (temp-> next,value)
Recursive solution of tower of Hanoi problem is an example of which of the following algorithm?
Dynamic Programming
Backtracking
Greedy algorithm
Divide and Conquer
Minimum time required to solve tower of Hanoi puzzle with 4 disks assuming one move takes 2 seconds, will be
15 Seconds
30 Seconds
16 Seconds
32 Seconds
Which of the following is a sub string of “SANFOUNDRY”?
SANO
FOUND
SAND
FOND
Which is the worst method of choosing a pivot element?
First element as pivot
Last element as pivot
Median - of - Three - Partioning
Random element as Pivot
Which among the following is the best cut-off range to perform insertion sort within a quick sort?
N = 0 - 5
N = 5 - 20
N = 20 - 30
N > 30
Quick sort uses join operation rather than merge operation.
TRUE
FALSE
Which of the following areas do closest pair problem arise?
Computational geometry
Graph coloring problems
Numerical problems
String matching
Which approach is based on computing the distance between each pair of distinct points and finding a pair with the smallest distance?
Brute force
Exhaustive Search
Divide and Conquer
Branch and bound
Manhattan distance is an alternative way to define a distance between two points.
True
False
The optimal time obtained through divide and conquer approach using merge sort is the best case efficiency.
True
False
Which of the points are closer to each other?
P11 and P11
P3 and P8
P2 and P3
P9 and P10
Cross product is also known as?
Scalar Product
Vector Product
Dot Product
Multiplication
What is the other name for quick hull problem?
Convex hull
Concave hull
Closest pair
Path Conversation
What does the following diagram depict?
Closest pair
Convex hull
Concave Hull
Path Compression
What is the average case complexity of a quick hull algorithm?
O(N)
O(N LOG N)
O(N2)
O(Log N)
The quick hull runs faster if the input uses non extremes points
True
False
Dijkstra’s Algorithm is used to solve _____________ problems
All pair shortest path
Single source shortest path
Network flow
Sorting
What is the basic principle behind Bellman Ford Algorithm?
Interpolation
Extrapolation
Regression
Relaxation
When dynamic programming is applied to a problem, it takes far less time as compared to other methods that don’t take advantage of overlapping subproblems.
True
False
When a top-down approach of dynamic programming is applied to a problem, it usually _____________
Decreases both, the time complexity and the space complexity
Decreases the time complexity and increases the space complexity
Increases the time complexity and decreases the space complexity
Increases both, the time complexity and the space complexity
Which of the following problems is NOT solved using dynamic programming?
0/1 knapsack problem
Matrix chain multiplication problem
Edit distance problem
Fractional knapsack problem
Which of the following problems should be solved using dynamic programming?
Merge Sort
Binary Search
Longest Common subsequence
Quick Sort
To calculate c(i, j )’s , w( i, j)’s and r(i, j)’s; the OBST algorithm in worst case takes the following time.
O(log n)
O (n4)
O (n3)
O (n log n)
What is the type of the algorithm used in solving the 4 Queens problem?
Greedy
Dynamic
Branch and Bound
Backtracking
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
Arrange the values Pi/Wi in ascending order
Arrange the values Pi/Xi in ascending order
Arrange the values Pi/Wi in descending order
Arrange the values Pi/Xi in descending order
Greedy job scheduling with deadlines algorithms’ complexity is defined as
O(N)
Ω( n log n)
O (n2 log n)
O ( n log n)
From the following choose the one which belongs to the algorithm paradigm other than to which others from the following belongs to
Minimum & Maximum problem
Knapsack problem
Selection problem
Merge sort
Identify the name of the sorting in which time is not proportional to n2
Selection sort
Bubble sort
Quick sort
Insertion sort.
The optimal solution to a problem is a combination of optimal solutions to its subproblems. This is known as
Principle of Duality
Principle of Feasibility
Principle of Optimality
Principle of Dynamicity
Which of the following versions of merge sort algorithm does uses space efficiently?
Contiguous version
Array version
Linked version
Structure version
Heap version.
Identify the correct problem for multistage graph from the list given below
Resource allocation problem
Traveling salesperson problem
Producer consumer problem
Barber’s problem
From the following pick the one which does not belongs to the same paradigm to which others belongs to.
Minimum & Maximum problem
Knapsack problem
Selection problem
Merge sort
The amount of time needs to run to completion is known as____________
Space complexity
Time complexity
Worst case
Best case
__________ is the minimum number of steps that can executed for the given parameters
Average Case
Time Complexity
worst case
Best case
Graphical representation of algorithm is _____________________
Pseudo-code
Flow chart
Graph coloring
Dynamic programing
In pseudo-code conventions input express as __________
Input
Read
Write
Return
Time complexity of given algorithm Algorithm Display(A)
{
S:=0.0; For i:=0 to n-1
{
S:=S+A[i];
Return S;
}
}
4n+4
4n2+4
2n2+2n+2
4n+4
Time complexity of given algorithm Algorithm Sum(A,S)
{
for i:=1 to n-1
{
for j:=2 to n-1
{
S:=S+i+j;
return S;
}
}
}
6n2-14n+4
6n2+14n+10
4n2+6n+12
6n2-14n+10
This algorithm scans the list by swapping the entries whenever pair of adjacent keys are out of desired order.
Insertion sort.
Bubble sort.
Shell sort
Quick sort.
In analysis of algorithm, approximate relationship between the size of the job and the amount of work required to do is expressed by using _________
Central tendency
Differential equation
Order of execution
Order of magnitude
Order of Storage
How many recursive calls are there in
Recursive matrix multiplication through
Simple Divide and Conquer Method
4
7
5
9
If Matrix X is of order A*B and Matrix Y
is of order C*D, and B=C then the order of
the Matrix X*Y is A*D?
True
False
Which of the following is considered as the
top of the stack in the linked list
implementation of the stack
Last node
First node
Middle node
Random mode
Which of the following methods can be
used to find the largest and smallest element
in an array
Recursion
Iteration
Both recursion and Iteration
No method is suitable
Recursive solution of tower of hanoi
problem is an example of which of the
following algorithm
Dynamic Programming
Back Tracking
Greedy algorithm
Divide and Conquer
Quick sort follows Divide-and-Conquer
strategy
True
False
Name the node which has been generated but none of its children nodes have been generated in state space tree of backtracking method.
Dead Node
Live Node
E Node
State Node
Testing of a program consists of 2 phases which are ______________________and ____________
Average case & Worst case
Time complexity & Space complexity
Validation and checking errors
Debugging and profiling
The amount of time needs to run to completion is known as____________
Space Complexity
Time Complexity
Best complexity
Worst Complexity
Prims algorithm is based on _____________ method
Divide and conquer method
Greedy method
Branch and bound
Dynamic programming
The general criteria of algorithm; algorithm must terminates after a finite number of steps ______
Output
Finiteness
Effectiveness
Input
O-notation provides an asymptotic
upper bound
lower bound
light bound
none of these
The minimum number of colors needed to color a graph having n>3 vertices and 2 edges is
2
3
4
1
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: (()(())(()))
1
2
3
4
The upper bound on the time complexity of the nondeterministic sorting algorithm is
O(n)
O(n log n)
O(1)
O( log n)
O(n2).
How do you determine the cost of a spanning tree?
By the sum of the costs of the edges of the tree
By the sum of the costs of the edges and vertices of the tree
By the sum of the costs of the vertices of the tree
By the sum of the costs of the edges of the graph
By the sum of the costs of the edges and vertices of the graph
Sorting is not possible by using which of the following methods?
Insertion
Selection
Deletion
Exchange
This algorithm scans the list by swapping the entries whenever pair of adjacent keys are out of desired order
Insertion sort.
Bubble sort
Shell sort.
Quick sort.
fractional knapsack is based on ____________method
greedy method
dynamic programming
branch and bound
divide and conquer
In Algorithm Specification the blocks are indicated with matching _______
Braces
Parenthesis
Square Brackets
Slashes
____________ 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
Dynamic programming
Backtracking
Branch and bound
Greedy method
