ProgrammingModerate

A matrix of 10 x 10 is searched linearly for a value. About how many cell reads happen in the worst case?

  1. A. 10
  2. B. 100
  3. C. 20
  4. D. 1000

Correct answer: B. 100

A linear search may have to check every cell before finding the value or proving it absent, so the worst case is 10 x 10 = 100 reads. 10 checks a single row, and 20 adds the dimensions instead of multiplying.

More C Programming questions

Exams that ask this topic