**1. Which of the following is NOT a characteristic of an algorithm?**

a) Finiteness

b) Determinism

c) Heuristic

d) Effectiveness

**Answer:** c) Heuristic

**Explanation:** An algorithm must be deterministic, meaning it produces the same output for a given input every time. It must also be effective, meaning it can be carried out within finite time using a finite amount of resources. However, heuristics involve trial and error and are not guaranteed to find the optimal solution, thus making them unsuitable for algorithms.

**2. What is the purpose of analyzing algorithms?**

a) To determine their runtime efficiency

b) To debug errors in the code

c) To beautify the code

d) To add more features to the algorithm

**Answer:** a) To determine their runtime efficiency

**Explanation:** Analyzing algorithms helps in understanding how the algorithm performs in terms of time and space requirements, which is crucial for choosing the most efficient algorithm for a given problem.

**3. Which asymptotic notation is used to represent the worst-case time complexity of an algorithm?**

a) O-notation

b) Ω-notation

c) Θ-notation

d) None of the above

**Answer:** a) O-notation

**Explanation:** O-notation is used to represent the upper bound or worst-case time complexity of an algorithm.

**4. What data structure is typically used to implement a priority queue efficiently?**

a) Stack

b) Queue

c) Heap

d) Linked List

**Answer:** c) Heap

**Explanation:** A heap is a suitable data structure for implementing a priority queue because it allows efficient retrieval and removal of the highest (or lowest) priority element.

**5. Which sorting algorithm has a time complexity of O(n log n) in the worst-case scenario?**

a) Bubble Sort

b) Insertion Sort

c) Quick Sort

d) Selection Sort

**Answer:** c) Quick Sort

**Explanation:** Quick Sort has an average-case time complexity of O(n log n), and its worst-case time complexity is also O(n log n).

**6. Which of the following algorithms uses the “divide and conquer” technique?**

a) Bubble Sort

b) Insertion Sort

c) Merge Sort

d) Selection Sort

**Answer:** c) Merge Sort

**Explanation:** Merge Sort follows the divide and conquer strategy by dividing the array into smaller sub-arrays, sorting them recursively, and then merging them back together.

**7. What is the time complexity of binary search algorithm in the worst-case scenario?**

a) O(n)

b) O(n log n)

c) O(log n)

d) O(n^2)

**Answer:** c) O(log n)

**Explanation:** Binary search has a time complexity of O(log n) in the worst-case scenario because it halves the search space in each iteration.

**8. Which sorting algorithm is known for its usage of the “partitioning” step?**

a) Bubble Sort

b) Merge Sort

c) Quick Sort

d) Heap Sort

**Answer:** c) Quick Sort

**Explanation:** Quick Sort partitions the array based on a pivot element and recursively sorts the sub-arrays.

**9. What is the key operation in Strassen’s matrix multiplication algorithm?**

a) Addition

b) Multiplication

c) Subtraction

d) Division

**Answer:** b) Multiplication

**Explanation:** Strassen’s matrix multiplication algorithm reduces the number of multiplications by performing some additions and subtractions strategically.

**10. Which algorithm is suitable for sorting a linked list efficiently?**

a) Quick Sort

b) Merge Sort

c) Bubble Sort

d) Insertion Sort

**Answer:** b) Merge Sort

**Explanation:** Merge Sort is suitable for sorting linked lists efficiently because it doesn’t require random access to elements, unlike Quick Sort, making it well-suited for linked lists.

**11. In heap sort, what type of heap is used?**

a) Max Heap

b) Min Heap

c) Binary Heap

d) Fibonacci Heap

**Answer:** a) Max Heap

**Explanation:** Heap Sort typically uses a max heap to sort elements in ascending order.

**12. What is the time complexity of heap sort in the worst-case scenario?**

a) O(n)

b) O(n log n)

c) O(log n)

d) O(n^2)

**Answer:** b) O(n log n)

**Explanation:** Heap Sort has a worst-case time complexity of O(n log n), making it efficient for large datasets.

**13. Which of the following sorting algorithms has the best average-case time complexity?**

a) Bubble Sort

b) Selection Sort

c) Merge Sort

d) Insertion Sort

**Answer:** c) Merge Sort

**Explanation:** Merge Sort has an average-case time complexity of O(n log n), which is better than the average-case time complexities of Bubble Sort, Selection Sort, and Insertion Sort.

**14. Which notation represents both upper and lower bounds of an algorithm’s time complexity?**

a) O-notation

b) Ω-notation

c) Θ-notation

d) None of the above

**Answer:** c) Θ-notation

**Explanation:** Θ-notation represents both upper and lower bounds of an algorithm’s time complexity, indicating tight asymptotic bounds.

**15. Which algorithm is NOT an example of a divide and conquer technique?**

a) Binary Search

b) Merge Sort

c) Bubble Sort

d) Quick Sort

**Answer:** c) Bubble Sort

**Explanation:** Bubble Sort is not an example of the divide and conquer technique. It follows the approach of repeatedly stepping through the list to be sorted and comparing each pair of adjacent items.

**16. Which of the following statements about Quick Sort is true?**

a) It is stable

b) It has a time complexity of O(n^2) in the worst-case scenario

c) It is not an in-place sorting algorithm

d) It uses divide and conquer strategy

**Answer:** d) It uses divide and conquer strategy

**Explanation:** Quick Sort follows the divide and conquer strategy by recursively partitioning the array into smaller sub-arrays.

**17. In the context of algorithms, what does the term “asymptotic analysis” refer to?**

a) Analyzing the performance of an algorithm for very large input sizes

b) Analyzing the performance of an algorithm for very small input sizes

c) Analyzing the performance of an algorithm on average

d) Analyzing the performance of an algorithm with random input

**Answer:** a) Analyzing the performance of an algorithm for very large input sizes

**Explanation:** Asymptotic analysis focuses on understanding the behavior of an algorithm as the input size approaches infinity.

**18. Which sorting algorithm has the best worst-case time complexity?**

a) Quick Sort

b) Merge Sort

c) Insertion Sort

d) Bubble Sort

**Answer:** b) Merge Sort

**Explanation:** Merge Sort has a worst-case time complexity of O(n log n), which is better than the worst-case time complexities of Quick Sort, Insertion Sort, and Bubble Sort.

**19. Which algorithm typically exhibits the best performance for sorting small arrays?**

a) Quick Sort

b) Merge Sort

c) Insertion Sort

d) Heap Sort

**Answer:** c) Insertion Sort

**Explanation:** Insertion Sort has a relatively low overhead and is efficient for small arrays or nearly sorted arrays.

**20. Which operation is NOT typically involved in the divide and conquer technique?**

a) Divide

b) Conquer

c

) Combine

d) Iterate

**Answer:** d) Iterate

**Explanation:** In the divide and conquer technique, the key operations are dividing the problem into smaller sub-problems (divide), solving the sub-problems recursively (conquer), and combining the solutions of the sub-problems (combine). Iteration may or may not be involved depending on the specific algorithm, but it’s not a defining characteristic of the divide and conquer technique.