
DAA CA-1
Quiz by Yashaswini B M
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
- Q1
Which of the following are applications of Topological Sort of a graph?
Course Scheduling
OS Deadlock Detection
All of the above
Sentence Ordering
30s - Q2
The running time of quick sort depends on the selection of.
Selection of pivot elements
Arrangements of the elements
Number of input
Number of passes
30s - Q3
A sort which relatively passes through a list to exchange the first element with any element less than it and then repeats with a new first element is called________.
heap sort
Insertion sort
Quick sort
Bubble sort
30s - Q4
Time complexities of three algorithms are given. Which should execute the slowest for large values of N?
O(N)
O(N ½)
O(log n)
O(nlog n)
30s - Q5
What is the time complexity of the following code snippet in C++?
void solve()
{ string s = "scaler";
int n = s.size();
for(int i = 0; i < n; i++)
{ s = s + s[i];
}
cout << s << endl;
}
O(n)
O(n^2)
O(log n)
O(1)
30s - Q6
Identify the slowest sorting technique among the following?
Merge Sort
Quick Sort
Selection sort
Bubble sort
30s - Q7
Breadth first search __________
Scans all the nodes in random order.
Scans all incident edges before moving to other node.
Scans each incident node along with its children.
Is same as backtracking
30s - Q8
Identify the sorting technique which compares adjacent elements in a list and switches whenever necessary?
Merge sort
Bubble sort
Selection sort
Quick sort
30s - Q9
Among the following options which is the best sorting algorithm when the list is already sorted?
Bubble sort
Merge sort
Selection sort
Insertion sort
30s - Q10
PERMUTE-BY-SHORTING(A)n=A.lengthLet P[1…n] be a new array For i=1 to n P[i]=RANDOM(1,n3) Sort A,using P as sort keys The time complexity of above algorithm is
T(n)
T(n ln n)
T(n2)
T(n3)
30s - Q11
Consider the following code:
#include<stdio.h>
int recursive_sum(int n)
{
if(n == 0)
return 0;
return ________;
}
int main()
{
int n = 5;
int ans = recursive_sum(n);
printf("%d",ans);
return 0;
}
Which of the following lines is the recurrence relation for the abovecode?
(n – 1) +recursive_sum(n)
n + recursive_sum(n)
n + recursive_sum(n – 1)
(n – 1) + recursive_sum(n)
30s - Q12
Prim’s algorithm starts constructing a minimum spanning tree from ___.
An arbitary root vertex
The right most vertex
The left most vertex
The shortest arcd.
30s - Q13
___ is a concept wherein larger solutions for problems are found based upon the solution of a number of smaller problems.
Decrease and conquer
Backtracking
Branch and bound
Divide and conquer
30s - Q14
Which Data Structure is used to perform Recursion?
linked list
queue
Array
stack
30s - Q15
Fractional knapsack problem is solved most efficiently by which of the following algorithm?
Dynamic Programming
Divide And Conquer
Backtracking
Greedy Algorithm
30s