PPS (C Language) •
MCQ • Basic Algorithms
Most Important 30 Objective Question - Basic Algorithms
Q1. Algorithm means:
A) Hardware device
B) Step-by-step procedure to solve a problem
C) Programming language
D) Output device
Answer: B
Explanation:
An algorithm is a finite sequence of logical steps used to solve a problem.
Q2. Flowchart is:
A) Program code
B) Graphical representation of algorithm
C) Compiler output
D) Operating system
Answer: B
Explanation:
Flowchart visually represents the logic of an algorithm using symbols.
Q3. Which searching method checks elements one by one?
A) Binary Search
B) Linear Search
C) Quick Sort
D) Merge Sort
Answer: B
Explanation:
Linear Search checks each element sequentially until the item is found.
Q4. Binary Search works on:
A) Unsorted array
B) Sorted array
C) Linked list only
D) Graph only
Answer: B
Explanation:
Binary Search requires data to be sorted before searching.
Q5. Which sorting compares adjacent elements?
A) Bubble Sort
B) Binary Search
C) Selection Sort
D) Recursion
Answer: A
Explanation:
Bubble Sort compares neighboring elements and swaps them if needed.
Q6. Which sorting repeatedly selects smallest element?
A) Bubble Sort
B) Selection Sort
C) Insertion Sort
D) Merge Sort
Answer: B
Explanation:
Selection Sort repeatedly finds the minimum element and places it correctly.
Q7. Which sorting inserts element at correct position?
A) Bubble Sort
B) Selection Sort
C) Insertion Sort
D) Linear Search
Answer: C
Explanation:
Insertion Sort places each element in its proper position.
Q8. Best searching for small unsorted data is:
A) Binary Search
B) Linear Search
C) Merge Sort
D) DFS
Answer: B
Explanation:
Linear Search is simple and suitable for small unsorted data.
Q9. Worst case of Linear Search is:
A) First element found
B) Last element found or absent
C) Middle element found
D) Array sorted
Answer: B
Explanation:
Worst case occurs when the item is last or not present.
Q10. Time complexity of Linear Search is:
A) O(1)
B) O(log n)
C) O(n)
D) O(n²)
Answer: C
Explanation:
Linear Search may check all elements, so complexity is O(n).
Q11. Time complexity of Binary Search is:
A) O(n)
B) O(log n)
C) O(n²)
D) O(1)
Answer: B
Explanation:
Binary Search repeatedly divides the search space, giving O(log n).
Q12. Bubble Sort worst case complexity is:
A) O(log n)
B) O(n)
C) O(n²)
D) O(1)
Answer: C
Explanation:
Bubble Sort uses nested comparisons, resulting in O(n²).
Q13. Selection Sort worst case complexity is:
A) O(n²)
B) O(log n)
C) O(n)
D) O(1)
Answer: A
Explanation:
Selection Sort also performs nested comparisons leading to O(n²).
Q14. Insertion Sort worst case complexity is:
A) O(n²)
B) O(log n)
C) O(1)
D) O(n)
Answer: A
Explanation:
Insertion Sort may require many shifts, giving O(n²).
Q15. Binary Search finds:
A) Minimum value
B) Maximum value
C) Position of target element
D) Array size
Answer: C
Explanation:
Binary Search is used to locate the target element’s position.
Q16. Which is divide and conquer technique?
A) Binary Search
B) Linear Search
C) Bubble Sort
D) Selection Sort
Answer: A
Explanation:
Binary Search divides the array into halves repeatedly.
Q17. Number of comparisons in best case of Linear Search:
A) 1
B) n
C) n²
D) log n
Answer: A
Explanation:
If first element matches, only one comparison is needed.
Q18. Which sorting is easiest to understand?
A) Bubble Sort
B) Merge Sort
C) Quick Sort
D) Heap Sort
Answer: A
Explanation:
Bubble Sort is simple and easy for beginners to understand.
Q19. Which searching is faster for large sorted data?
A) Linear Search
B) Binary Search
C) Bubble Sort
D) Selection Sort
Answer: B
Explanation:
Binary Search is much faster for large sorted datasets.
Q20. Which algorithm is used to find maximum element?
A) Traversing array
B) Binary Search
C) Bubble Sort
D) Insertion Sort
Answer: A
Explanation:
Simple traversal helps compare and find the maximum value.
Q21. Swapping is mainly used in:
A) Sorting
B) Input
C) Output
D) Compilation
Answer: A
Explanation:
Swapping helps place elements in correct order during sorting.
Q22. Which variable stores temporary value in swapping?
A) temp
B) max
C) sum
D) count
Answer: A
Explanation:
Temporary variable stores one value during swapping.
Q23. Searching means:
A) Rearranging elements
B) Finding an element
C) Deleting file
D) Opening compiler
Answer: B
Explanation:
Searching is the process of locating a required item.
Q24. Sorting means:
A) Finding element
B) Arranging data in order
C) Writing file
D) Compiling code
Answer: B
Explanation:
Sorting arranges data in ascending or descending order.
Q25. Ascending order means:
A) Largest to smallest
B) Smallest to largest
C) Random order
D) Reverse only
Answer: B
Explanation:
Ascending order arranges values from small to large.
Q26. Descending order means:
A) Smallest to largest
B) Largest to smallest
C) Random order
D) Equal values only
Answer: B
Explanation:
Descending order arranges values from large to small.
Q27. Which algorithm repeatedly swaps adjacent elements?
A) Selection Sort
B) Bubble Sort
C) Binary Search
D) DFS
Answer: B
Explanation:
Bubble Sort repeatedly swaps neighboring elements.
Q28. Which sorting selects minimum repeatedly?
A) Insertion Sort
B) Selection Sort
C) Bubble Sort
D) Linear Search
Answer: B
Explanation:
Selection Sort repeatedly selects the smallest remaining element.
Q29. Which sorting shifts elements?
A) Insertion Sort
B) Binary Search
C) Linear Search
D) DFS
Answer: A
Explanation:
Insertion Sort shifts elements to insert correctly.
Q30. Which algorithm is best for already sorted data?
A) Insertion Sort
B) Bubble Sort
C) Linear Search
D) Selection Sort
Answer: A
Explanation:
Insertion Sort performs very efficiently when data is already nearly sorted.
Google AdSense Ad Placement Here 📢