Systematic Debugging and Root Cause Analysis Questions
Methodically diagnosing failures and identifying their true cause. Covers hypothesis-driven debugging, bisection and instrumentation, full-stack and production diagnosis, debugging under pressure, and root-cause analysis that prevents recurrence. Emphasizes a repeatable process over guesswork.
Given this Java binary search implementation:
int binarySearch(int[] a, int target) {
int lo = 0, hi = a.length;
while (lo < hi) {
int mid = (lo + hi) / 2;
if (a[mid] == target) return mid;
else if (a[mid] < target) lo = mid + 1;
else hi = mid;
}
return -1;
}
Identify any bug(s), explain the loop invariant that should hold, provide a corrected implementation, and list test cases you would run to validate the fix (including edge cases).
An app occasionally freezes for a few seconds right after the user taps a button that triggers a network call. What would make you suspect the network code specifically, and how would you confirm it?
In Java, multiple threads increment a shared counter with the following code:
public class Counter {
private int count = 0;
public void increment() { count++; }
public int get() { return count; }
}
If 100 threads call increment concurrently, describe the bug, why it happens, and provide two correct fixes with trade-offs (show concise code or API choices).
This Swift view model never gets deallocated, even after the screen that owns it is dismissed:
class ViewModel {
var onUpdate: (() -> Void)?
func subscribe() {
onUpdate = {
self.refresh()
}
}
}
What's the bug, and how do you confirm it before shipping the fix?
Your crash reporting tool shows one fatal exception is responsible for 40% of crashes, but it only happens on a handful of device models you don't personally own. How do you root-cause it anyway?
Unlock Full Question Bank
Get access to all 10 Systematic Debugging and Root Cause Analysis interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.