Question.3
A developer computes the midpoint in binary search:
int mid = (low + high) / 2;
For very large arrays (e.g., low = 1,500,000,000 and high = 2,000,000,000 on a system where int is 32-bit signed), what can go wrong?
low = 1,500,000,000
high = 2,000,000,000
int
Select Answer
Nothing — integer division always works correctly
The division produces a floating-point result that gets truncated
low + high overflows int, producing a negative value
Only fails on 16-bit MCUs, not 32-bit