MCQOPTIONS
Saved Bookmarks
This section includes 85 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
If gcd (a, b) is defined by the expression, d=a*p + b*q where d, p, q are positive integers and a, b is both not zero, then what is the expression called? |
| A. | Bezout's Identity |
| B. | Multiplicative Identity |
| C. | Sum of Product |
| D. | Product of Sum |
| Answer» B. Multiplicative Identity | |
| 2. |
What is the time complexity of matrix multiplied recursively by Strassen's Method? |
| A. | O(nlog7) |
| B. | O(n2) |
| C. | O(n3) |
| D. | O(n!) |
| Answer» B. O(n2) | |
| 3. |
What is the GCD of a and b? |
| A. | a + b |
| B. | gcd (a-b, b) if a>b |
| C. | gcd (a+b, a-b) |
| D. | a – b |
| Answer» C. gcd (a+b, a-b) | |
| 4. |
In terms of Venn Diagram, which of the following expression gives GCD (Given A ꓵ B ≠ Ø)? |
| A. | Multiplication of A U B terms |
| B. | Multiplication of A ꓵ B terms |
| C. | Multiplication of A*B terms |
| D. | Multiplication of A-B terms |
| Answer» C. Multiplication of A*B terms | |
| 5. |
What is the bidirectional variant of selection sort? |
| A. | cocktail sort |
| B. | bogo sort |
| C. | gnome sort |
| D. | bubble sort |
| Answer» B. bogo sort | |
| 6. |
Can binary search be applied on a sorted linked list in O(Logn) time? |
| A. | No |
| B. | Yes |
| Answer» B. Yes | |
| 7. |
In terms of Venn Diagram, which of the following expression gives LCM (Given A ꓵ B ≠ Ø)? |
| A. | Multiplication of A U B terms |
| B. | Multiplication of A ꓵ B terms |
| C. | Multiplication of A*B terms |
| D. | Multiplication of A-B terms |
| Answer» B. Multiplication of A ꓵ B terms | |
| 8. |
Is gcd an associative function. |
| A. | True |
| B. | FALSE |
| Answer» C. | |
| 9. |
Which of the following can be the base case for the recursive implementation used to find the length of linked list? |
| A. | if(current_node == 0) return 1 |
| B. | if(current_node->next == 0) return 1 |
| C. | if(current_node->next == 0) return 0 |
| D. | if(current_node == 0) return 0 |
| Answer» E. | |
| 10. |
What will be the best case time complexity of recursive selection sort? |
| A. | O(n) |
| B. | O(n2) |
| C. | O(log n) |
| D. | O(n log n) |
| Answer» C. O(log n) | |
| 11. |
Which of the following methods can be used to search an element in a linked list? |
| A. | Iterative linear search |
| B. | Iterative binary search |
| C. | Recursive binary search |
| D. | All of the mentioned |
| Answer» B. Iterative binary search | |
| 12. |
What will be time complexity when binary search is applied on a linked list? |
| A. | O(1) |
| B. | O(n) |
| C. | O(n2) |
| D. | O(n3) |
| Answer» C. O(n2) | |
| 13. |
What is the time complexity of the above recursive implementation of linear search? |
| A. | O(1) |
| B. | O(n) |
| C. | O(n2) |
| D. | O(n3) |
| Answer» C. O(n2) | |
| 14. |
What is the advantage of iterative code for finding power of number over recursive code? |
| A. | Iterative code requires less time |
| B. | Iterative code requires less space |
| C. | Iterative code is more compiler friendly |
| D. | It has no advantage |
| Answer» C. Iterative code is more compiler friendly | |
| 15. |
What is the time complexity of the above recursive implementation of binary search? |
| A. | O(n) |
| B. | O(2n) |
| C. | O(logn) |
| D. | O(n!) |
| Answer» D. O(n!) | |
| 16. |
Which of the following methods can be used to find the sum of first n natural numbers? |
| A. | Iteration |
| B. | Recursion |
| C. | Binomial coefficient |
| D. | All of the mentioned |
| Answer» E. | |
| 17. |
What is the space complexity of the above recursive implementation to find the nth fibonacci number? |
| A. | O(1) |
| B. | O(2*n) |
| C. | O(n2) |
| D. | O(2n) |
| Answer» B. O(2*n) | |
| 18. |
What is the time complexity of the above recursive implementation to find the nth fibonacci number? |
| A. | O(1) |
| B. | O(2*n) |
| C. | O(n2) |
| D. | O(2n) |
| Answer» E. | |
| 19. |
Which of the following is also known as LCM? |
| A. | Lowest Common Divisor |
| B. | Least Common Multiple |
| C. | Lowest Common Measure |
| D. | Highest Common Multiple |
| Answer» B. Least Common Multiple | |
| 20. |
What is the LCM of 48, 18, 6? |
| A. | 122 |
| B. | 12*2 |
| C. | 3 |
| D. | 6 |
| Answer» B. 12*2 | |
| 21. |
What is the LCM of two coprime numbers? |
| A. | 1 |
| B. | 0 |
| C. | Addition of two coprime numbers |
| D. | Multiplication of two coprime numbers |
| Answer» E. | |
| 22. |
Which of the following methods can be used to find the sum of digits of a number? |
| A. | Recursion |
| B. | Iteration |
| C. | Greedy algorithm |
| D. | Both recursion and iteration |
| Answer» E. | |
| 23. |
In terms of Venn Diagram, which of the following expression gives LCM (Given A ? B ? Ø)? |
| A. | Multiplication of A U B terms |
| B. | Multiplication of A ? B terms |
| C. | Multiplication of A*B terms |
| D. | Multiplication of A-B terms |
| Answer» B. Multiplication of A ? B terms | |
| 24. |
Which is the smallest number of 3 digits that is divisible by 2, 4, 8? |
| A. | 100 |
| B. | 102 |
| C. | 116 |
| D. | 104 |
| Answer» E. | |
| 25. |
Is 9 and 28 coprime number. |
| A. | True |
| B. | FalseView AnswerAnswer: aExplanation: Coprime numbers have GCD 1 and LCM is the product of the two given terms. So 9 and 28 are coprime numbers.11. What is the following expression, lcm (a, lcm (b, |
| C. | equal to?a) lcm (a, b, c)b) a*b*cc) a + b + c |
| D. | lcm (lcm (a, b), c) |
| Answer» E. | |
| 26. |
What can be the minimum sum of digits for a 4 digit number? |
| A. | 0 |
| B. | 1 |
| C. | 16 |
| D. | 36 |
| Answer» C. 16 | |
| 27. |
What is the lcm (a, b)? |
| A. | a + b |
| B. | gcd (a-b, b) if a>b |
| C. | lcm (b, a) |
| D. | a – b |
| Answer» D. a – b | |
| 28. |
Which of the following is not an alias for GCD? |
| A. | LCM |
| B. | GCM |
| C. | GCF |
| D. | HCF |
| Answer» B. GCM | |
| 29. |
Which of the following is an alias for LCM? |
| A. | GCD |
| B. | SCM |
| C. | GCF |
| D. | HCF |
| Answer» C. GCF | |
| 30. |
In terms of Venn Diagram, which of the following expression gives GCD (Given A ? B ? Ø)? |
| A. | Multiplication of A U B terms |
| B. | Multiplication of A ? B terms |
| C. | Multiplication of A*B terms |
| D. | Multiplication of A-B terms |
| Answer» C. Multiplication of A*B terms | |
| 31. |
If GCD of two number is 8 and LCM is 144, then what is the second number if first number is 72? |
| A. | 24 |
| B. | 2 |
| C. | 3 |
| D. | 16 |
| Answer» E. | |
| 32. |
Which of the following is coprime number? |
| A. | 54 and 24 |
| B. | 4 and 8 |
| C. | 6 and 12 |
| D. | 9 and 28 |
| Answer» E. | |
| 33. |
Is 9 and 28 coprime number? |
| A. | True |
| B. | False |
| Answer» B. False | |
| 34. |
What is the GCD of 48, 18, 0? |
| A. | 24 |
| B. | 2 |
| C. | 3 |
| D. | 6 |
| Answer» E. | |
| 35. |
Which of the following is also known as GCD? |
| A. | Highest Common Divisor |
| B. | Highest Common Multiple |
| C. | Highest Common Measure |
| D. | Lowest Common Multiple |
| Answer» B. Highest Common Multiple | |
| 36. |
What is the LCM of 8 and 13? |
| A. | 8 |
| B. | 12 |
| C. | 20 |
| D. | 104 |
| Answer» E. | |
| 37. |
What is the GCD of 8 and 12? |
| A. | 8 |
| B. | 12 |
| C. | 2 |
| D. | 4 |
| Answer» E. | |
| 38. |
Recursion is a method in which the solution of a problem depends on ____________ |
| A. | Larger instances of different problems |
| B. | Larger instances of the same problem |
| C. | Smaller instances of the same problem |
| D. | Smaller instances of different problems |
| Answer» D. Smaller instances of different problems | |
| 39. |
What is the space complexity of the above recursive implementation to find the factorial of a number? |
| A. | O(1) |
| B. | O(n) |
| C. | O(n2) |
| D. | O(n3) |
| Answer» B. O(n) | |
| 40. |
What is the time complexity of the program to reverse stack when linked list is used for its implementation? |
| A. | O(n) |
| B. | O(n log n)C) O(n2)D) O(log n) |
| Answer» B. O(n log n)C) O(n2)D) O(log n) | |
| 41. |
Which of the following sorting algorithm has best case time complexity of O(n2)? |
| A. | bubble sort |
| B. | selection sort |
| C. | insertion sort |
| D. | stupid sort |
| Answer» C. insertion sort | |
| 42. |
Which of the following is the biggest advantage of selection sort? |
| A. | its has low time complexity |
| B. | it has low space complexity |
| C. | it is easy to implement |
| D. | it requires only n swaps under any condition |
| Answer» E. | |
| 43. |
What will be the recurrence relation of the code of recursive selection sort? |
| A. | T(n) = 2T(n/2) + n |
| B. | T(n) = 2T(n/2) + c |
| C. | T(n) = T(n-1) + n |
| D. | T(n) = T(n-1) + c |
| Answer» D. T(n) = T(n-1) + c | |
| 44. |
Which of the following takes O(n) time in worst case in array implementation of stack? |
| A. | pop |
| B. | push |
| C. | isEmpty |
| D. | none |
| Answer» E. | |
| 45. |
Which of the following code correctly represents the function to reverse stack without using recursion? |
| A. | #include <stack>void reverseStack(stack<int> &input, stack<int> &extra){ while(inp |
| B. | #include <stack>void reverseStack(stack<int> &input, stack<int> &extra){ while(inp |
| C. | #include <stack>void reverseStack(stack<int> &input, stack<int> &extra){ while( |
| Answer» C. #include <stack>void reverseStack(stack<int> &input, stack<int> &extra){ while( | |
| 46. |
Recursive selection sort is a comparison based sort. |
| A. | true |
| B. | false |
| Answer» B. false | |
| 47. |
Which of the following is considered as the top of the stack in the linked list implementation of the stack? |
| A. | Last node |
| B. | First node |
| C. | Random node |
| D. | Middle node |
| Answer» C. Random node | |
| 48. |
Which of the following sorting algorithm is NOT stable? |
| A. | Selection sort |
| B. | Brick sort |
| C. | Bubble sort |
| D. | Merge sort |
| Answer» B. Brick sort | |
| 49. |
What will be the time complexity of the code to reverse stack recursively? |
| A. | O(n) |
| B. | O(n log n) |
| C. | O(log n) |
| D. | O(n2) |
| Answer» E. | |
| 50. |
Consider the array {1,1,1,1,1}:Which of the following techniques can be used to search an element in the above array? |
| A. | Iterative linear search |
| B. | Recursive linear search |
| C. | Recursive binary search |
| D. | All of the mentioned |
| Answer» E. | |