Daa 1
Daa 1
1 Master’s theorem is used for? solving recurrences solving iterative relations analysing loops calculating the time complexity of any code solving recurrences
2 How many cases are there under Master’s theorem? 2 3 4 5 3
3 We can solve any recurrence by using Master’s theorem. TRUE FALSE FALSE
Under what case of Master's theorem will the recurrence
4 1 2 3 It cannot be solved using master’s theorem 2
relation of merge sort fall?
Under what case of Master's theorem will the recurrence
5 1 2 3 It cannot be solved using master’s theorem 2
relation of binary search fall?
The time complexity of recurrence relation T(n) = T(n/3) +
6 O(Ig n) O(n) O(n Ig n) O(n^2 ) O(n Ig n)
T(2n/3) + O(n) is
Which of the following case does not exist in complexity
7 Best case Worst case Average case Null case Null case
theory?
(1) find the characteristic (1) compute the solution (1) find the characteristic (1) find the characteristic
equation, (2) compute the coefficients, (2) find the equation, (2) find the roots (1) find the roots of the characteristic equation, equation, (2) find the roots of
Which is the correct order for the steps to find a solution of
8 solution coefficients, (3) characteristic equation, (3) of the characteristic (2) compute the solution coefficients, (3) find the characteristic equation, (3)
a homogeneous linear recurrence?
find the roots of the find the roots of the equation, (3) compute the the characteristic equation compute the solution
characteristic equation characteristic equation solution coefficients coefficients
If for an algorithm time complexity is given by O(1) then the
9 constant polynomial exponential none of the mentioned constant
complexity of it is ____________
Out of the following which property algorithms does not
10 Input Finiteness Generality Constancy Constancy
share?
11 Two main measures for the efficiency of an algorithm are Processor and memory Complexity and capacity Time and space Data and space Time and space
If the hardware is used If the software is used If there is more than one If there is more than one
21 What should be considered when designing an algorithm? All the answers are true
correctly correctly way to solve the problem way to solve the problem
Only when we want to
At any time to design
22 When can we use algorithms? Only with computers Only when programming put our flowchart in At any time to design solutions to problems
solutions to problems
place.
What shape represents the beginning and end of a
23 Oval Rectangle Diamond Square Oval
flowchart?
Sometimes more
Much more complicated
Much easier to analyze complicated and Much more complicated to
24 The average case complexity of an algorithm is _______? to analyze than the None of the above
than the worst case sometimes simpler than analyze than the worst case
worst case
the worst case
The maximum memory The minimum memory The average memory size
The maximum disk space size required by The maximum memory size
25 Space factor is measured by ____? size required by the size required by the required by the
the algorithm required by the algorithm
algorithm algorithm algorithm
Recursion uses more memory space than iterations It uses the stack instead Each recursive call must Each recursive call must be
26 Both A and B are true. Aucune de ces réponses n’est vraie.
because _____? of the queue. be stored. stored.
The element is in the last
The worst case occurs in the linear search algorithm when The element is in the The element is not in the The element is in the last The element is in the last position of the
27 position of the array or it
________? middle of the array array position of the array array or it does not exist
does not exist
X will be a better choice X will be a better choice
What does it mean when we say that an algorithm X is X will be a better choice X will be a better choice for
28 for all except small for all except large Y will be a better choice for small entries
asymptotically more efficient than Y? for all inputs all except small entries
entries entries
For data collections
For relatively permanent For relatively permanent
29 Arrays are the best data structures whose structure is All the answers are true None of the above
data collections data collections
constantly changing
Consider the following for loops: If n is the size of the input,
30 for(i = 0; i < n; i++) for(i = 0; i < n; i += 2) for(i = 1; i < n; i *= 2) for(i = n; i < -1; i /= 2) for(i = 1; i < n; i *= 2)
which loop is more efficient?