Which of the following best describes an algorithm?
A) A random set of programming statements
B) A sequence of unambiguous instructions to solve a problem in finite time
C) A compiled code ready for execution
D) A sequence of ambiguous steps to solve a problem
2. What is a necessary condition for each step in an algorithm?
A) It must be non-ambiguous
B) It must produce an output
C) It must be written in a programming language
D) It must use flowcharts
3. Which of the following is true about algorithm representations?
A) Flowcharts are required for all algorithms
B) Pseudocode is the only valid form of algorithm representation
C) The same algorithm can be represented in different ways
D) Every algorithm has only one possible representation
4. What is an algorithm design technique?
A) A method of writing flowcharts
B) A debugging strategy
C) A general approach for solving problems algorithmically
D) A specific program for one problem only
5. Which of the following statements about pseudocode is correct?
A) It cannot be used to describe algorithm logic
B) It combines natural and programming language with simplified syntax
C) It includes variable declarations and syntax rules
D) It is a complete programming language
6. What does algorithm correctness refer to?
A) Its ability to minimize space usage
B) Its ability to solve problems faster than any other method
C) Its ability to provide the correct result for all valid inputs in finite time
D) Its ability to compile without error
7. What does the worst-case efficiency of an algorithm represent?
A) The number of variables used in the code
B) Its efficiency for the input of size n that causes the longest running time
C) The average number of errors it can produce
D) Its efficiency for the least amount of input
8. Which of the following best describes the meaning of \Theta(g(n)) in algorithm analysis?
A) The set of all functions with a smaller or same order of growth as g(n)
B) The set of all functions with a larger or same order of growth as g(n)
C) The set of all functions that have the same order of growth as g(n)
D) The set of all functions that grow faster than g(n) in the worst case
9. Which of the following algorithms employs the divide-and-conquer paradigm?
A) Bubble sort
B) Merge sort
C) Insertion sort
D) Selection sort
Write (T) in front of the true sentence and (F) in front of the false sentence:
* Time efficiency refers to how much extra memory an algorithm uses. (F)
* Simplicity in an algorithm means it is easier to understand and usually leads to fewer bugs in the resulting program. (T)
* Generality refers to how many different programming languages an algorithm supports. (F)
* Merge Sort is very efficient for large datasets. (T)
Question 1: Multiple Choice Question (MCQ)
1. What is Quick Sort?
A) A sorting algorithm that uses a single loop to sort elements in linear time.
B) A fast, divide-and-conquer sorting algorithm that selects a pivot and partitions the array.
C) A sorting algorithm that sorts elements by inserting them into their correct positions one by one.
D) A sorting algorithm that sorts elements by repeatedly merging subarrays.
2. What are the advantages of Quick Sort?
A) It is slower than Merge Sort in most cases.
B) It requires extra memory for sorting.
C) It is very fast in practice, performs in-place sorting, and often outperforms Merge Sort.
D) It is only suitable for small arrays.
3. What is Counting Sort?
A) A sorting algorithm that compares each element with every other element.
B) A non-comparison sorting algorithm that counts the number of occurrences of each element.
C) A divide-and-conquer sorting algorithm that uses a pivot.
D) A recursive sorting algorithm based on merging subarrays.
4. What is Radix Sort?
A) A sorting algorithm that compares adjacent elements and swaps them.
B) A comparison-based sorting algorithm using a pivot element.
C) A non-comparison sorting algorithm that processes numbers digit by digit, starting from the least significant digit (LSD).
D) A recursive sorting algorithm based on binary trees.
5. What is Brute Force?
A) A highly optimized method that skips unnecessary steps using heuristics.
B) A straightforward approach that directly applies the problem statement and definitions to find a solution.
C) A recursive algorithm that uses divide-and-conquer to solve problems efficiently.
D) A method that always guarantees the most efficient solution using minimal steps.
6. What is a major disadvantage of the Brute Force approach?
A) It always requires complex data structures.
B) It is too optimized for simple problems.
C) It is not suitable for real-time applications.
D) It only works with floating-point numbers.
7. What is Sequential (Linear) Search?
A) A method that finds an element by dividing the list into halves..
B) A straightforward method that searches for an element by checking each element in the list.
C) A search algorithm that uses a hash table to locate elements instantly.
D) A recursive search method that works only on sorted arrays.
8. What is Binary Search?
A) A search algorithm that checks each element in an unsorted list one by one.
B) An inefficient method for searching in large datasets.
C) An extremely efficient search algorithm that works on sorted arrays.
D) A method that stores all elements in a tree before searching.
9. What is Dijkstra's Algorithm used for?
A) Sorting elements in ascending order.
B) Searching for elements in a binary search tree.
C) Finding the shortest path from a starting point to all other points in a graph.
D) Encrypting messages using public-key cryptography.
10. What are the disadvantages of Dijkstra's Algorithm?
A) It always works with negative weights and is very fast.
B) It doesn't work with negative weights and can be memory and time-consuming for very large graphs.
C) It only works on undirected graphs.
D) It requires a binary search tree to function.
Question 2: List three Applications of Dijkstra's Algorithm.
* GPS, Navigation Systems
* Robotics
* Emergency Response
Algorithms | Time Complexity (BEST CASE) |
Brute Force | O(n) |
Sequential/Linear Search | O(1) |
Binary Search | O(1) |
Selection Sort | O(n²) |
Bubble Sort | O(n) |
Insertion Sort | O(n) |
Merge Sort | O(n log n) |
Quick Sort | O(n log n) |
Counting Sort | O(n + k) |
Radix Sort | O(d × (n + k)) |