Algorithms MCQs (Set-1)

What does an algorithm specify?

A A processor's wiring
B Steps for solving a problem
C A database table
D A programming language name

What should a correct algorithm produce?

A Required result for valid input
B Random output every run
C Only a printed message
D A sorted list always

What does time complexity describe?

A Exact clock time
B Program file size
C Growth in operation count
D Processor temperature

What does space complexity measure?

A Growth in memory use
B Number of source lines
C Network speed
D Compiler version

What does Big O usually express?

A Asymptotic upper bound
B Exact execution time
C Minimum memory address
D A loop's starting value

What does Big Omega express?

A Asymptotic lower bound
B Exact running time
C Maximum input length
D Average source code size

What does Big Theta express?

A A strict upper bound only
B Tight asymptotic bound
C A random estimate
D Exact instruction count

What is worst case analysis?

A Minimum work for input size
B Work on sorted input only
C Expected work after randomization
D Maximum work for input size

What is best case analysis?

A Maximum work for input size
B Minimum work for input size
C Average memory use
D Work on every possible input

What does average case analysis require?

A A sorted input always
B A fixed processor clock
C A hash table only
D An input probability model

A single loop over n items is typically?

A O(n)
B O(1)
C O(log n)
D O(n squared)

Two nested loops each over n items are typically?

A O(n squared)
B O(n)
C O(log n)
D O(1)

Repeatedly halving n items takes how many levels?

A O(n)
B O(n squared)
C O(log n)
D O(1)

What prerequisite does binary search need?

A Sorted data
B Unique values
C A linked list
D Negative numbers

What is linear search's key advantage?

A Always logarithmic time
B Requires a tree
C Finds duplicates in constant time
D Works without sorted order

What is selection sort's typical time complexity?

A O(n log n)
B O(log n)
C O(n squared)
D O(1)

What is insertion sort's best case on sorted data?

A O(n squared)
B O(n)
C O(log n)
D O(n log n)

What is merge sort's typical time complexity?

A O(n squared)
B O(n log n)
C O(log n)
D O(1)

What is quicksort's average time complexity?

A O(n squared)
B O(log n)
C O(1)
D O(n log n)

What is quicksort's worst case time complexity?

A O(n log n)
B O(log n)
C O(1)
D O(n squared)

What does a stable sort preserve?

A Original array capacity
B The exact memory addresses
C Order of equal keyed items
D Input values without comparisons

What does an in place algorithm usually limit?

A Input size
B Number of output values
C Number of comparisons always
D Extra auxiliary memory

What does quicksort partitioning do?

A Combines sorted halves
B Finds a graph path
C Groups items around a pivot
D Builds a hash function

What does merge sort's merge step do?

A Chooses a graph root
B Hashes each element
C Combines sorted sequences
D Reverses every subarray

Why does a recursive algorithm need a base case?

A To increase its input
B To stop recursive calls
C To sort its function names
D To allocate a queue