Algorithms Quiz Bank – 50 MCQs
Q1: Linear Search always starts searching from:
a) Middle
b) End
c) Beginning
d) Random
Answer: c
Q2: Best case time complexity of Linear Search:
a) O(n²)
b) O(n log n)
c) O(n)
d) O(1)
Answer: d
Q3: Worst case time complexity of Linear Search:
a) O(1)
b) O(n)
c) O(log n)
d) O(n²)
Answer: b
Q4: Linear Search can be applied to:
a) Sorted only
b) Unsorted only
c) Both
d) None
Answer: c
Q5: If element not present, Linear Search will:
a) Crash
b) Search entire array
c) Return false immediately
d) Return index = -1
Answer: b
Q6: Binary Search requires:
a) Sorted data
b) Random data
c) Linked list
d) None
Answer: a
Q7: Best case time complexity of Binary Search:
a) O(1)
b) O(log n)
c) O(n)
d) O(n log n)
Answer: a
Q8: Worst case time complexity of Binary Search:
a) O(n)
b) O(log n)
c) O(n²)
d) O(1)
Answer: b
Q9: Binary Search fails when used on:
a) Sorted arrays
b) Balanced tree
c) Unsorted arrays
d) Strings
Answer: c
Q10: Maximum comparisons in Binary Search:
a) n
b) log■n
c) n/2
d) √n
Answer: b
Q11: Worst case complexity of Bubble Sort:
a) O(n²)
b) O(n)
c) O(log n)
d) O(n log n)
Answer: a
Q12: Best case complexity of Bubble Sort:
a) O(n)
b) O(n²)
c) O(log n)
d) O(n log n)
Answer: a
Q13: Bubble Sort is inefficient because:
a) Recursive
b) Too many swaps
c) Requires O(n) space
d) Cannot sort integers
Answer: b
Q14: Bubble Sort is stable because:
a) Keeps equal order
b) Always O(n log n)
c) Recursive
d) None
Answer: a
Q15: Bubble Sort works by:
a) Finding max element
b) Swapping adjacent elements
c) Divide & Conquer
d) Heap property
Answer: b
Q16: Best case complexity of Insertion Sort:
a) O(n²)
b) O(n log n)
c) O(n)
d) O(1)
Answer: c
Q17: Worst case complexity of Insertion Sort:
a) O(n²)
b) O(n log n)
c) O(n)
d) O(1)
Answer: a
Q18: Insertion Sort is efficient when data is:
a) Large
b) Random
c) Nearly sorted
d) Reverse sorted
Answer: c
Q19: Insertion Sort is:
a) Stable
b) Not stable
c) Recursive
d) Non-comparison
Answer: a
Q20: Insertion Sort is good for:
a) Large
b) Small
c) Trees
d) Graphs
Answer: b
Q21: Worst case complexity of Selection Sort:
a) O(n²)
b) O(n)
c) O(n log n)
d) O(1)
Answer: a
Q22: Best case complexity of Selection Sort:
a) O(n²)
b) O(n)
c) O(log n)
d) O(n log n)
Answer: a
Q23: Selection Sort is:
a) Stable
b) Not stable
c) Recursive
d) None
Answer: b
Q24: Selection Sort is useful when:
a) Swaps are costly
b) Comparisons are costly
c) Memory costly
d) Huge data
Answer: a
Q25: Selection Sort always makes:
a) n log n comparisons
b) n² comparisons
c) log n comparisons
d) √n comparisons
Answer: b
Q26: Average case complexity of Quick Sort:
a) O(n²)
b) O(n log n)
c) O(n)
d) O(1)
Answer: b
Q27: Worst case complexity of Quick Sort:
a) O(n²)
b) O(n log n)
c) O(n)
d) O(1)
Answer: a
Q28: Quick Sort is based on:
a) DP
b) Divide & Conquer
c) Greedy
d) Backtracking
Answer: b
Q29: Quick Sort requires extra memory:
a) O(1)
b) O(n)
c) O(log n)
d) O(n²)
Answer: c
Q30: Quick Sort is:
a) Stable
b) Not stable
c) Non-comparison
d) Brute force
Answer: b
Q31: Time complexity of Merge Sort:
a) O(n²)
b) O(n log n)
c) O(n)
d) O(log n)
Answer: b
Q32: Merge Sort is based on:
a) Divide & Conquer
b) Greedy
c) DP
d) Brute force
Answer: a
Q33: Merge Sort is:
a) In-place
b) Not in-place
c) Stable
d) Both b and c
Answer: d
Q34: Merge Sort needs extra memory:
a) O(1)
b) O(log n)
c) O(n)
d) O(n²)
Answer: c
Q35: Merge Sort is best for:
a) Linked lists
b) Arrays
c) Small data
d) None
Answer: a
Q36: 0/1 Knapsack is:
a) Polynomial
b) NP-complete
c) Greedy
d) Brute force
Answer: b
Q37: Fractional Knapsack solved using:
a) DP
b) Greedy
c) Divide & Conquer
d) Backtracking
Answer: b
Q38: 0/1 Knapsack uses:
a) DP
b) Divide & Conquer
c) Greedy
d) BFS
Answer: a
Q39: Knapsack divides items in:
a) 0/1 or Fractional
b) Single
c) Weighted
d) Sorted
Answer: a
Q40: Knapsack aims to:
a) Min time
b) Max profit
c) Min space
d) Max weight
Answer: b
Q41: Job Sequencing solved using:
a) DP
b) Greedy
c) Divide & Conquer
d) BFS
Answer: b
Q42: Job Sequencing objective:
a) Min time
b) Max profit
c) Min jobs
d) Min deadline
Answer: b
Q43: Jobs sorted by:
a) Deadline
b) Profit
c) Weight
d) Duration
Answer: b
Q44: Job Sequencing works best when:
a) Small deadlines
b) Unlimited jobs
c) Deadlines > n
d) Equal profits
Answer: a
Q45: Job Sequencing is:
a) DP problem
b) Scheduling problem
c) Graph problem
d) Search problem
Answer: b
Q46: Kruskal’s Algorithm finds:
a) Shortest Path
b) MST
c) Max Flow
d) Topological
Answer: b
Q47: Kruskal’s Algorithm sorts:
a) Vertices
b) Edges
c) Degrees
d) Paths
Answer: b
Q48: Kruskal’s Algorithm is based on:
a) DP
b) Divide & Conquer
c) Greedy
d) Backtracking
Answer: c
Q49: Data structure in Kruskal’s:
a) Queue
b) Union-Find
c) Stack
d) Priority Queue
Answer: b
Q50: Kruskal’s stops when:
a) All edges used
b) (V – 1) edges selected
c) Graph disconnected
d) Tree balanced
Answer: b