Font size
WorksheetsDAA 2023- 2024 Test 8
Total questions: 100
Worksheet time: 1hrs 18mins
What is the time complexity of this code
int a = 0, i = N;
while (i > 0)
{
a += i;
i /= 2;
}
O(N)
O(Sqrt(N))
O(N / 2)
O(log N)
The complexity of Binary search algorithm is
O(n)
O(log n)
O(n2)
O(n log n)
Time Complexity of this program:
def f():
a = 0
for i = 1 to n:
a += i;
b = 0
for i = 1 to m:
b += i;
O(n)
O(m)
O(n+m)
O(n*m)
The complexity of Bubble sort algorithm is
O(n)
O(log n)
O(n2)
O(n log n)
If for an algorithm time complexity is given by O(1) then complexityof it is:
constant
polynomial
exponential
none of the mentioned
If for an algorithm time complexity is given by O(log2n) then complexity will:
constant
polynomial
exponential
none of the mentioned
If for an algorithm time complexity is given by O(n) then complexityof it is:
A. constant
B. linear
C. exponential
D. none of the mentioned
To measure Time complexity of an algorithm Big O notation is used which:
A. describes limiting behaviour of the function
B. characterises a function based on growth of function
C. upper bound on growth rate of the function
D. all of the mentioned
What is the time complexity of following code:
int a = 0;
for (i = 0; i < N; i++) {
for (j = N; j > i; j--) {
a = a + i + j;
}
}
O(N)
O(N*log(N))
O(N * Sqrt(N))
O(N*N)
What is the time complexity of following code:
int i, j, k = 0;
for (i = n / 2; i <= n; i++) {
for (j = 2; j <= n; j = j * 2) {
k = k + n / 2;
}
}
O(n)
O(nLogn)
O(n^2)
O(n^2Logn)
Which of the problems cannot be solved by backtracking method?
n-queen problem
subset sum problem
Hamiltonian circuit problem
travelling salesman problem
Backtracking algorithm is implemented by constructing a tree of choices called as?
State-space tree
state chart tree
node tree
Backtracking tree
The problem of finding a path in a graph that visits every vertex exactly once is called?
Hamiltonian path problem
Hamiltonian cycle problem
sum of subset problem
Turnpike reconstruction problem
Which of the following problems is similar to that of a Hamiltonian path problem?
Knapsack problem
closest pair problem
travelling salesman problem
assignment problem
The problem of finding a subset of positive integers whose sum is equal to a given positive integer is called as?
n- queen problem
sum of subsets problem
knapsack problem
Hamiltonian circuit problem
Branch and bound is a __________
problem solving technique
data structure
sorting algorithm
type of tree
Choose the correct statement from the following.
Greedy method is efficient than dynamic programming approach
Backtracking approach gives only one optimal solution
Branch and bound can be used for solving Optimization problems
None of these
Problems that can be solved in polynomial time are known as?
intractable
tractable
decision
complete
28. _________ is the class of decision problems that can be solved by non-deterministic polynomial algorithms?
NP
P
Hard
Complete
Problems that can be verified in Polynomial time are called
P problems
NP problems
Tractable problems
none of these
To which of the following class does a CNF-satisfiability (say 3-SAT)problem belong?
NP class
P class
NP complete
NP hard
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
A greedy algorithm can be used to solve all the dynamic programming problems.
True
False
What happens when the backtracking algorithm reaches a complete solution?
It backtracks to the root
It continues searching for other possible solutions
It traverses from a different route
Recursively traverses through the same route
..................................... of an undirected graph is to find minimum subset of vertices that cover all the edges.
3-SAT Problem
Clique problem
Boolean problem
vertex cover problem
A graph with 'n' number of vertices is said to be complete if it contains ............number of edges.
n
n-1
n(n-1)/2
n/2
....................... is the act of finding a set of variable assignments to True or False that make that statement true or alternately providing a proof that no such set of variable assignments can exist.
3-SAT Problem
Vertex Cover Problem
Clique problem
Clique decision problem
Clique is a sub-graph of a graph which is complete.
True
False
Dynamic programming differs from the greedy method since the greedy method produces only one feasible solution, which may or may not be optimal, while dynamic programming produces all possible sub-problems at most once, one of which guaranteed to be optimal.
True
False
A...................... is a maximal connected sub-graph of a graph
Component
Connected component
Bi-connected component
none
........................ are a type of computer memory used to quickly accept, store, and transfer data and instructions that are being used immediately by the CPU.
Input Unit
Registers
Output Unit
Control memory
The symbolic notation used to describe the micro-operations performed on registers is called a ............................................
Binary Language
High level language
Register Transfer Language
None of these
Operations that can be performed on data stored in Registers are called...........
Micro operations
Binary operations
Low level operations
High level operations
................................ are the categories of Register Micro-operations
Register Transfer Micro operations
Arithmetic Micro operations
Logic Micro operations
Shift Micro operations
All of the above
......................................... Micro-operations implies transfer of binary information form one register to another register.
Register Transfer Micro-operations
logic Micro-operations
shift Micro-operations
Arithmetic Micro-operations
...............................micro operations perform Arithmetic operations on numeric data stored in registers.
Logic
Arithmetic
Shift
Register Transfer
.........................micro operations perform shift operations on data stored in registers.
Shift
Logic
Register Transfer
Arithmetic
..........................micro -operations perform bit manipulation operations on non numeric data stored in registers.
shift
Logic
Register Transfer
Arithmetic
........................Operator is used to transfer data from from one register to another register
Conditional Operator
Replacement operator
Unary Operator
Binary operator
A multiplexer also known as a data selector, is a device that selects between several analog or digital input signals and forwards it to a single output line.
True
False
........................... , ........................ 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
What is the running time of Strassen's algorithm for matrix multiplication?
O(n2.81)
O(n3)
O(n1.8)
O(n2)
Which of the following standard algorithms is not Dynamic Programming based
Floyd Warshall Algorithm for all pairs shortest paths
0-1 Knapsack problem
Prim's
Optimal Binary Search Trees
In dynamic programming, the technique of storing the previously calculated values is called .....
Saving value property
Storing value property
Memoization
Mapping
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 sub problems.
True
False
Floyd Warshall’s Algorithm is used for solving ____________
All pair shortest path problems
Single Source shortest path problems
Network flow problems
Sorting problems
What is the time complexity of Dijikstra’s algorithm?
O(N)
O(N3)
O(N2)
O(logN)
Prim's algorithm is a .....
Divide and conquer algorithm
Greedy algorithm
Dynamic Programming
Approximation algorithm
From the following given tree, what is the code word for the character ‘a’?
011
010
100
101
Two main measures for the efficiency of an algorithm are
Time and Space
Processor and Memory
Complexity and Capacity
Data and space
Which algorithm is used to solve a maximum flow problem?
Prim’s algorithm
Kruskal’s algorithm
Dijkstra’s algorithm
Ford-Fulkerson algorithm
The "I" in the AIDA stands for
Impact
Interest
Intution
Importance
The "D" in the AIDA stands for
Denial
Detailing
Duplication
Desire
It is culturally acceptable to show enthusiasm
US Culture
UK Culture
This culture believes in Hierarchy
US Culture
UK Culture
The globally number 1 time waster is _________
Indecision
Aimless Meetings
Over Reliance on Emails
Web Surfing Breaks
The globally number 2 time waster is _________
Indecision
Aimless Meetings
Over Reliance on Emails
Web Surfing Breaks
RAC Stands for
Record - Assimilate - Change
Record - Analyse - Change
Receive - Analyse - Change
Record - Analyse - Collaborate
Which one of these statements is true about Customer Focus
Be problem focused
Be solution focused
Be task focused
Be deliverable focused
Small talk is an absolute must in this culture
US Culture
UK Culture
Supervisors encourage creativity over hierarchy
US Culture
UK Culture
Which of the following standard algorithms is not Dynamic Programming based.
Bellman–Ford Algorithm for single source shortest path
Floyd Warshall Algorithm for all pairs shortest paths
0-1 Knapsack problem
Prim's Minimum Spanning Tree
