ProgrammingHard

A program uses a while loop that finds the smallest power of two at least n for n = 1000, starting from 1. What value does it return?

  1. A. 512
  2. B. 1000
  3. C. 2000
  4. D. 1024

Correct answer: D. 1024

1000 is not a power of two, and 512 is too small. The smallest power of two at least 1000 is 1024.

More C Programming questions

Exams that ask this topic