Algorithmic Efficiency MCQ Practice

Question 1 of 10

In the worst case, how many elements does a linear scan inspect in a list of n = 9 items?

  1. A. 81
  2. B. 3
  3. C. 9
  4. D. 18

Question 2 of 10

A sorted list of 32 items is searched by binary search that halves each time: 32→16→8→4→2→1. How many halvings is that?

  1. A. 32
  2. B. 16
  3. C. 3
  4. D. 5

Question 3 of 10

Algorithm U takes 4n steps. Algorithm V takes 20 steps regardless of n. For n = 3, which uses fewer steps?

  1. A. U uses 12 and V uses 20, so U uses fewer
  2. B. U uses 12 and V uses 20, so V uses fewer
  3. C. Both use 3 steps
  4. D. Both use 60 steps

Question 4 of 10

For large n on a sorted list, why is binary search generally fewer steps than scanning every item?

  1. A. Binary search requires the list to be unsorted
  2. B. Binary search discards about half the remaining items each check instead of visiting all n
  3. C. Binary search always visits all n items twice
  4. D. Linear scan skips all items

Question 5 of 10

An instance of a problem includes:

  1. A. only the font of the code editor
  2. B. a guarantee that no algorithm exists
  3. C. the general task plus specific input values
  4. D. only the programmer name

Question 6 of 10

Step-count table:

n Algo X Algo Y
1 2 2
2 4 4
3 6 8
4 8 16

X matches 2n. Y matches 2^n. For n = 5, which predicted pair is correct?

  1. A. X = 32, Y = 10
  2. B. X = 5, Y = 5
  3. C. X = 25, Y = 25
  4. D. X = 10, Y = 32

Question 7 of 10

Some problems have no known efficient exact algorithm for large inputs. A common response is to:

  1. A. seek approximate or heuristic solutions that use fewer steps
  2. B. insist on listing every possibility even when 2^n exceeds available time
  3. C. stop measuring step counts entirely
  4. D. declare that efficiency never matters

Question 8 of 10

Algorithm Nested runs an outer loop n times and an inner loop n times, doing 1 step in the inner body (about n^2 steps). For n = 6, about how many inner-body steps?

  1. A. 12
  2. B. 36
  3. C. 64
  4. D. 6

Question 9 of 10

Which pair correctly contrasts decision and optimization problems?

  1. A. Decision problems cannot be solved by computers; optimization always can in one step
  2. B. They are identical for every problem statement
  3. C. Decision: yes/no answer; optimization: find a best solution among many
  4. D. Decision: always needs exponential steps; optimization: never uses algorithms

Question 10 of 10

For n = 4, algorithm Linear does 4 steps and algorithm Square does 16 steps. Which uses more steps?

  1. A. They use the same number
  2. B. Neither uses any steps
  3. C. Linear
  4. D. Square