ProgrammingModerate

A program runs a loop body 10^8 times and each iteration does one multiply and one add on ints. Roughly how long does this take on typical hardware?

  1. A. Several hours
  2. B. Well under a second, often around a tenth of a second
  3. C. About 10 minutes
  4. D. Roughly a year

Correct answer: B. Well under a second, often around a tenth of a second

A simple loop does about 10^9 simple operations per second, so 10^8 iterations take around a tenth of a second.

More C Programming questions

Exams that ask this topic