- 1. Algorithms are step-by-step procedures or formulas for solving problems. They are a set of instructions that describe how to perform a task or solve a problem effectively. Algorithms are used in various fields such as computer science, mathematics, engineering, and more. They help in organizing data, making decisions, and automating processes. By designing efficient algorithms, we can optimize the use of resources, improve performance, and solve complex problems in a systematic way.
Which sorting algorithm has a worst-case time complexity of O(n2)?
A) Bubble Sort B) Quick Sort C) Merge Sort D) Heap Sort
- 2. What data structure is typically used in a Depth-First Search (DFS) algorithm?
A) Array B) Binary Tree C) Stack D) Queue
- 3. Which algorithm is commonly used to find the shortest path in a graph with non-negative edge weights?
A) A* search algorithm B) Prim's algorithm C) Bellman-Ford algorithm D) Dijkstra's algorithm
- 4. What does the 'recursion' mean in the context of algorithms?
A) A function that calls itself in a problem-solving process. B) A function that has no return statement. C) A function that generates random numbers. D) A function that iterates over a collection of elements.
- 5. Which algorithm is used to find the transitive closure of a directed graph?
A) Floyd's algorithm B) Tarjan's algorithm C) Warshall's algorithm D) Kosaraju's algorithm
- 6. Which algorithm can be used to find the maximum flow in a flow network?
A) Binary Search algorithm B) Ford-Fulkerson algorithm C) Bubble Sort D) Depth-First Search
- 7. What is the main advantage of the breadth-first search (BFS) algorithm over depth-first search (DFS)?
A) DFS finds the path more quickly. B) BFS is easier to implement. C) BFS guarantees the shortest path to the goal. D) DFS uses less memory space.
- 8. Which algorithm is used to find the longest common subsequence between two sequences?
A) Heap Sort B) Radix Sort C) Longest Common Subsequence algorithm D) Selection Sort
- 9. What is the term for the measure of how detailed the instructions are in an algorithm?
A) Efficiency B) Scalability C) Complexity D) Granularity
- 10. What data structure is typically used in a Breadth-First Search algorithm?
A) Linked List B) Stack C) Queue D) Heap
- 11. What is the primary goal of the Floyd-Warshall algorithm?
A) To determine the largest connected component in an undirected graph. B) To calculate the maximum flow in a flow network. C) To find the shortest paths between all pairs of vertices in a weighted graph. D) To sort elements in ascending order.
- 12. What is the process of making a repetitive sequence shorter by using previous occurrences called?
A) Run-Length Encoding B) Differential Encoding C) Burrows-Wheeler Transform D) Huffman Coding
- 13. Which of the following is a divide and conquer algorithm?
A) Merge Sort B) Insertion Sort C) Bubble Sort D) Selection Sort
- 14. What is the worst-case time complexity of the Quick Sort algorithm?
A) O(n log n) B) O(n2) C) O(n) D) O(log n)
|