Computer Science EngineeringHardISRO SC (CS)

A binary counter starts at 0 and is incremented 500 times. The total number of bit flips (0->1 and 1->0) over all increments is:

  1. A. 500
  2. B. 1000
  3. C. 995
  4. D. 994

Correct answer: D. 994

Bit k flips floor(n/2^k) times; sum = 994 (less than 2n).

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic