WorksheetsDAA KCS 503 Tutorial Quiz
Total questions: 77
Worksheet time: 3hrs 0mins
Which sorting algorithm makes one swap per pass (possibly swapping an element with itself)?
Selection Sort
Bubble Sort
Insertion Sort
Which sorting algorithm may make multiple swaps per pass?
Bubble Sort
Selection Sort
Insertion Sort
Which sorting algorithm shifts elements instead of swapping elements if needed in each pass.
Bubble Sort
Selection Sort
Insertion Sort
How many passes will both the selection and insertion sorts make?
N
N-1
N+1
(N+1)/2
The following lists represent 3 passes of a sorting algorithm. Which algorithm is being used to sort the list?
4 5 9 6 2 7
4 5 6 2 7 9
4 5 2 6 7 9
Bubble Sort
Selection Sort
Insertion Sort
The following lists represent 3 passes of a sorting algorithm. Which algorithm is being used to sort the list?
4 8 6 2 5 7
4 8 6 2 5 7
4 6 8 2 5 7
Bubble Sort
Selection Sort
Insertion Sort
The following lists represent 3 passes of a sorting algorithm. Which algorithm is being used to sort the list?
4 8 3 9 2 6
2 8 3 9 4 6
2 3 8 9 4 6
Bubble Sort
Selection Sort
Insertion Sort
We are sorting the following list in ascending order:
1 4 2 9 3 8 5
What does the list look like after one pass of the bubble sort algorithm.
1 2 4 3 8 5 9
1 4 2 5 3 8 9
4 2 9 3 8 5 1
We are sorting the following list in descending order:
1 4 2 9 3 8 5
What does the list look like after one pass of the selection sort algorithm.
1 4 2 9 3 8 5
9 4 2 1 3 8 5
4 2 9 3 8 5 1
We are sorting the following list in ascending order:
1 4 2 9 3 8 5
What does the list look like after one pass of the insertion sort algorithm.
1 4 2 9 3 8 5
4 2 9 3 8 5 1
4 1 2 9 3 8 5
Which of the following is not a stable sorting algorithm?
a) Insertion sort
b) Selection sort
c) Bubble sort
d) Merge sort
Which of the following is a stable sorting algorithm?
a) Merge sort
b) Typical in-place quick sort
c) Heap sort
d) Selection sort
Running merge sort on an array of size n which is already sorted is
a) O(n)
b) O(nlogn)
c) O(n2)
d) None
Which of the following is not a non comparison sort?
a) Counting sort
b) Bucket sort
c) Radix sort
d) Shell sort
The time complexity of heap sort in worst case is
a) O(logn)
b) O(n)
c) O(nlogn)
d) O(n2)
If the given input array is sorted or nearly sorted, which of the following algorithm gives the best performance?
a) Insertion sort
b) Selection sort
c) Quick sort
d) Merge sort
Which of the following algorithm pays the least attention to the ordering of the elements in the input list?
a) Insertion sort
b) Selection sort
c) Quick sort
d) None
Time complexity of bubble sort in best case is
a) θ (n)
b) θ (nlogn)
c) θ (n2)
d) θ (n(logn) 2)
Which of the following is not an in-place sorting algorithm?
a) Selection sort
b) Heap sort
c) Quick sort
d) Merge sort
The data structure used for Depth First Algorithm is
STACK
QUEUE
BOTH STACK & QUEUE
NONE OF THESE
In linear Search Algorithm basic operation is
Element Comparison with key Element
Increment operation
Decrement Operation
None of these
Efficiency of an Algorithm is decided by the
Number of times the basic operation is executed
Time taken for executing the program
Number of instructions in the program
All of these
Worst case efficiency of Binary Search is
O(n)
O(n log n)
O(Log n)
O(n2)
Heap should satisfy
Shape Property
Parental Dominance Property
Both Shape and Parental Dominance Property
None of these
Which of the following algorithm does not use greedy technique
Prims Algorithm-
Kruskals Algorithm
Dijkstras Algorithm
Floyds Algorithm
A greedy algorithm can be used to solve all the dynamic programming problems.
True
False
Read the following statements carefully, and choose the correct answer:
I. For the Backtracking algorithms stack data structure is used.
II. For the Branch-and-bound algorithms queue data structure is used.
(I) is FALSE but (II) is TRUE
(I) and (II) both are FALSE
(I) is TRUE but (II) is FALSE
(I) and (II) both are TRUE
(II) is TRUE and (I) can’t be defined.
"Both LIFO branch and bound strategy and backtracking leads to depth first search.-"The statement is true/false?
(a)
The algorithm is part of the blueprint or plan for the ________
Computer Program
Program
Algorithm
FLowchart
The algorithm should terminate after the ________ number of steps.
Infinite
Finite
Both a and b
The instructions which are used in algorithm should be clear and ______
Ambigious
Unambiguous
Both a and b
None
______ is the key features of algorithm
Decision
Sequence
Both and b
None
Repitition is also known as
Iteration or looping
Condition
Unconditional
None
Identify the processes is the strategy for designing _______
Flowchart
Program
Algorithm
None
____________ is the process of executing programs on sample data sets to determine if faulty results occur
Profiling
Debugging
Searching
None
What are the strategy for designing algorithm is
Investigation step
Preliminary step
Refining step
None
Each and every instruction should simple and very basic
Effectiveness
Definiteness
Finiteness
Infiniteness
........................... , ........................ and ...........................are the different ways in which an algorithm can be specified.
Asymptotic Notations, Flowchart, Pseudocode
English like statements, Flowchart, Pseudocode
English like statements,Sets, Pseudsocode
None of the above
Algorithm can be represented graphically using...........................
barchart
Graph
Pie chart
Flowchart
...............................is defined as step by step procedure for solving a particular problem
Space complexity
Time complexity
Performance Analysis
Algorithm
An Algorithm's performance an be analysed by using............................
Time complexity
Space Complexity
Number of inputs
Time and space complexity
..............................is defined as the amount of Computer time required to complete the execution of a program/problem
Space Complexity
Time complexity
CPU Time
None of these
Upper bound running time complexity of an algorithm is also called as.....................
Best case time complexity
Worst case time complexity
Average case time complexity
None of these
.......................is the amount of computer memory required to the execute the program /problem.
Time complexity
Space complexty
Memory complexity
None of these
Lower bound running time complexity of an algorithm is also called as.................
Best case time complexty
Worst case time complexity
Average case time complexity
None of these
............................Notation is used to represent strict upper bound running time complexity of an algotihm
Big-oh
Big-Omega
Theta
None of these
............................Notation is used to represent strict lower bound running time complexity of an algorithm.
Big-Oh
Big-Omega
Theta
None of these
.................................notation denotes Average case Time complexity
Big-Oh
Big Omega
Theta
None of these
........................................Notations are called as Asymptotic Notations.
Big-oh
Big-Omega
little-Theta
little-oh
theta
......................is used to represent strict upper bound running time complexity where as.................is used to represent upper bound running time complexity of an algorithm.
Big-oh,little-oh
little-oh,Big-oh
Big-oh,small-oh
small-oh,Big-oh
......................is used to represent strict lower bound running time complexity where as.................is used to represent lower bound running time complexity of an algorithm.
Big-Omega,small-omega
Big-Omega,little-omega
lttle-omega,Big-omega
small-omega,Big-Omega
Let f(n) and g(n) be two non-negative functions,f(n)=O(g(n)) if and only if..........................
f(n)<=c*g(n)
f(n)>=c*g(n)
f(n)<c*g(n)
f(n)<c*g(n)
Let f(n) and g(n) be two non-negative functions,f(n)= ω (g(n)) if and only if..........................
f(n)<=c*g(n)
f(n)>=c*g(n)
f(n)<c*g(n)
f(n)<c*g(n)
Let f(n) and g(n) be two non-negative functions,f(n)= θ (g(n)) if and only if..........................
c1*g(n)<=f(n)<=c2*g(n)
c1*g(n)>=f(n)>=c2*g(n)
c1*g(n)<f(n)<c2*g(n)
c1*g(n)>f(n)>c2*g(n)
...................................are the characteristics of an algorithm
Input
infiniteness
Effectiveness
output
finiteness
Find the time complexity for the following algorithm using step count method.
Algorithm sum(a,n)
{
nsum=0;
for(i=1;i<=n;i++)
{
nsum=nsum+a[i];
}
}
2n+2 units
2n+1 units
n+1 units
n+2 units
Find the space complexity for the following algorithm
Algorithm sum(a,b,c)
{
a=10;
b=20;
c=30;
d=a+b+c;
}
3 units
4 units
5 units
6 units
What does the following piece of code do?
for (int i = 0; i < arr.length-1; i++) {
for (int j = i+1; j < arr.length; j++) {
if( (arr[i].equals(arr[j])) && (i != j) ) {
System.out.println(arr[i]);
}
}
}
Print the duplicate elements in the array
Print the element with maximum frequency
Print the unique elements in the array
Prints the element with minimum frequnecy
A and B can complete a work in 6 days.A can alone do it in 10 days.Then B can alone do the work in how many days?
13.75 days
14 days
15 days
16 days
If two dice are thrown together,then the probability of getting an even number on one die and an odd number on other die is
1/4
1/2
3/4
3/5
Pointing to a girl in a photograph,Arun said "Her mother's brother is the only son of my mother's father".How is the girl's mother related to Arun?
Mother
Sister
Aunt
Grandma
A man walked 2 km west of his house and then he turned south covering 4 km.Finally,he moved 3 km towards east and then he again 1 km west.How far is he from his initial position?
10 km
9 km
2 km
4 km
Find the odd man out
carrot
cucumber
onion
beetroot
Fill the series 17,32,19,29,21,26,23,__,__
25,25
20,22
23,25
25,22
How is my father's mother's only daughter in law's sister related to me?
Aunt
sister
cousin
mother
Eleven friends M, N, O, P, Q, R, S, T, U, V and W are sitting in the first row of the stadium watching a cricket match.
T is to the immediate left of P and third to the right of U. V is the immediate neighbour of M and N and third to the left of S. M is the second to the right of Q, who is at one of the ends. R is sitting next to the right of P and P is second to the right of O. Who is sitting in the center of the row?
U
V
Q
W
