Algorithms MCQ – Data Structures & Complexity – Part 4
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. Which of the following sorting algorithms has the lowest worst-case complexity?
A Merge sort
B Bubble sort
C Quick sort
D Selection sort
2. The elements of an array are successively stored in memory spaces because _____?
A In this way, the computer can only keep track of the address of the first element and the addresses of the other elements can be calculated
B the architecture of the computer memory does not allow arrays to store other than serial
C Both A and B are true
D None of the above
3. Consider the following function
int fun(int n) { int i, j, k = 0; for (i = n/2; i <= n; i++) for (j = 2; j <= n; j = j * 2) k = k + n/2; return k; }
What is the value returned by the above function?
A Θ(n^2)
B Θ(n^2Logn)
C Θ(n^3)
D Θ(n^3Logn)
4. The complexity of the binary search algorithm is ______?
A O(n)
B O(log)
C O(n2)
D O(n log n)
5. Consider the following three instructions
- (n + m) ^ k = Θ(n ^ m), where k and m are constants
- 2 ^ (n + 1) = O(2 ^ n)
- 2 ^ (2n + 1 ) = O(2 ^ n)
Which of the following statements are correct?
A 1 and 2
B 1 and 3
C 2 and 3
D 1, 2, and 3
6. The result of iterating through a binary search tree is _____?
A An unsorted list
B A reverse of the input
C A sorted list
D None of the above
7. In the following gcd() function, we have : n >= m.
int gcd(n,m) { if (n%m ==0) return m; n = n%m; return gcd(m, n); }
How many recursive calls are made by this function?
A Θ(logn)
B Ω(n)
C Θ(loglogn)
D Θ(sqrt(n))
8. The queue is a data structure that operates on ______?
A LIFO
B FIFO
C FILO
D None of the above
9. Une liste chaînée est une structure dynamique?
A True
B False
10. Recursion uses more memory space than iterations because _____?
A It uses the stack instead of the queue.
B Each recursive call must be stored.
C Both A and B are true.
D Aucune de ces réponses n’est vraie.