Algorithm CA
Algorithm CA
Raphael institute
SECTION A
A) Efficiency
B) Correctness
C) Complexity
D) Simplicity
A) Dijkstra’s Algorithm
B) QuickSort
C) MergeSort
D) Both B and C
Question 5: Which of the following sorting algorithms is considered the most efficient on
average?
A) BubbleSort
B) MergeSort
C) QuickSort
D) InsertionSort
Question 7: Which tree traversal visits nodes in the order: root, left, right?
A) In-order
B) Pre-order
C) Post-order
D) Level-order
Question 8: Which algorithm is used to find the shortest path in a weighted graph?
A) Kruskal’s Algorithm
B) Dijkstra’s Algorithm
C) QuickSort
D) Floyd-Warshall Algorithm
Question 9: Which algorithm is used to find the Minimum Spanning Tree (MST) in a
graph?
A) Dijkstra’s Algorithm
B) Kruskal’s Algorithm
C) QuickSort
D) Floyd-Warshall Algorithm
Question 11: Which of the following is NOT a characteristic of Divide and Conquer
algorithms?
Question 12: Which of the following real-world systems uses Dijkstra’s Algorithm?
Question 13:
What does the "bubble" refer to in the Bubble Sort algorithm?
A) The smallest element in the list.
B) The process of comparing each element with its adjacent element.
C) The largest element that moves to its final position after each pass.
D) The middle element that gets sorted first.
Question 14:
Consider the following array: [5, 3, 8, 4, 2]. What will the array look like after the first
pass of the Bubble Sort algorithm?
A) [5, 3, 8, 4, 2]
B) [3, 5, 4, 2, 8]
C) [3, 4, 2, 5, 8]
D) [2, 3, 4, 5, 8]
Question 15:
How can we tell if the array is already sorted during the Bubble Sort algorithm?
A) If all elements are equal.
B) If no swaps are made during a full pass.
C) If the elements are in descending order.
D) If the first element is the largest.
Steps:
Example:
List: [2, 5, 1, 7, 3]
Question 16
Question 17
What will the algorithm return if all the numbers in the list are the same, e.g., [4, 4, 4, 4]?
A) 4
B) 0
C) The first number in the list
D) None of the above
Question 18
In a list [10, -2, 5, 0, -1], what happens when the algorithm checks -2?
A) It updates the largest number to -2.
B) It skips -2 because it is smaller than 10.
C) It swaps -2 with 10.
D) It adds -2 to the largest number.
SECTION B
SECTION C :(10mrks)
Question 20: find the shortest path from A to all other nodes in the graph below using the
Dijkstra's Algorithm