Algorithms MCQ – Data Structures & Complexity – Part 2
Computer architecture MCQ questions and answers for the preparation of tests, exams, and certifications. So you will find questions about loops and conditionals, data structure, complexity, flowchart, pseudocode, and much more. This systematic learning method will easily prepare anyone to pass their exam.
1. The average case complexity of an algorithm is _______?
A Much more complicated to analyze than the worst case
B Much easier to analyze than the worst case
C Sometimes more complicated and sometimes simpler than the worst case
D None of the above
[st_adsense]
2. Which of the following statements is not true about comparison-based sorting algorithms?
A The minimum possible time complexity of a comparison-based sorting algorithm is O (n*Logn) for a random input array.
B Any comparison-based sorting algorithm can be made stable by using position as a parameter when two elements are compared
C The Counting sort is not a sorting algorithm based on comparison
D Heap Sort is not a comparison-based sorting algorithm.
3. Two main measures for the efficiency of an algorithm are _______?
A Processor and memory
B Complexity and capacity
C Time and space
D Data and space
4. Consider w(n) and V(n), respectively, as the worst-case and average execution time of an algorithm run on an input of size n. Which of the following statements is ALWAYS TRUE?
A V(n) = Θ(w(n))
B V(n) = Ω(w(n))
C V(n) = O(w(n))
D V(n) = o(w(n))
[st_adsense]
5. Which of the following is not O (n ^ 2)?
A n ^ 3 / (sqrt (n))
B n ^ 1,78
C (13 ^ 10) * n + 12087
D (2 ^ 40) * n
6. Linked lists are best suited for ____?
A gathering of permanent data
B Size and constantly changing data
C All the answers are true
D None of the above
7. Which of the options provides the increasing order of the asymptotic complexity of g1, g2, g3 and g4 functions?
g1 (n) = 2 ^ n g2(n) = n ^ (3/2) g3(n) = n * Logn g4(n) = n ^ (logn)
A g3, g2, g4, g1
B g3, g2, g1, g4
C g2, g3, g1, g4
D g2, g3, g4, g1
8. Space factor is measured by ____?
A The maximum memory size required by the algorithm
B The minimum memory size required by the algorithm
C The average memory size required by the algorithm
D The maximum disk space size required by the algorithm
[st_adsense]
9. Consider the following program to reverse the digits of an integer. Where n = P1 * P2 … Pm
int n, res; res = 0; while (n > 0) { res = res*10 + n%10; n = n/10; }
The loop condition at the end of the iteration is as follows:
A n = P1*P2 … Pm-i and res = Pm*Pm-1 … Pm-i + 1
B n = Pm-i + 1… Pm-1 * Pm and res = Pm-1 … P2*P1
C n = P2*P1 … Pm and res = Pm * Pm-1 … P2*P1
D n! = res
10. What is the best time complexity of the bubble sort algorithm?
A N ^ 2
B N * logN
C N
D N (log * N) ^ 2
[st_adsense]