CS FundamentalsHardAccenture · Capgemini technical pattern

A bug exists at the current commit but not at a commit 200 commits earlier. Using git bisect (a binary search through history), what is the maximum number of commits you would need to test to find the first bad one?

  1. A. 200
  2. B. 100
  3. C. 8
  4. D. 14

Correct answer: C. 8

Each test halves the range of candidates. 2⁷ = 128 < 200 ≤ 256 = 2⁸, so at most ⌈log₂ 200⌉ = 8 tests. 100 assumes a linear scan stopping half-way on average.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic