Debugging and Systematic Troubleshooting Questions

Diagnosing defects methodically: reproducing failures, forming and testing hypotheses, reading stack traces and logs, bisecting changes, and reasoning about error handling and edge cases. Covers a disciplined root-cause approach that applies from local bugs to production issues, distinct from embedded hardware-level debugging. A universally probed engineering-craft skill.

EasyTechnical
38 practiced

You receive this Android crash stack trace from a user's device:

FATAL EXCEPTION: main
Process: com.example.app, PID: 12345
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
	at com.example.app.ui.MainActivity.onCreate(MainActivity.java:45)
	at android.app.Activity.performCreate(Activity.java:8000)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3000)

Identify the most likely root cause, what you would check in the source at that file and line, and two possible fixes.

MediumTechnical
24 practiced

You receive a bug report: a routine that removes duplicates from an array in place is intermittently failing with out-of-bounds writes in production, but it works fine in tests. Describe how you would debug this, what tests you would add, and which language-specific pitfalls, such as signed versus unsigned indices, integer overflow, or aliasing, you would check first.

HardTechnical
21 practiced

A production API sometimes returns elements in an inconsistent order across clients because sets are used internally. You are responsible for triage: how do you investigate, explain the nondeterminism to stakeholders, and implement a stable ordering for the API output while keeping acceptable performance?

EasyTechnical
28 practiced

Write a memory-efficient Python function parse_log_counts(file_path, top_n=5) that scans a large server log file, which may be larger than available memory, and returns the top N error types or HTTP status codes by count without loading the whole file into memory. Example lines: 2025-01-01T12:00:00Z INFO request_id=1 status=200 and 2025-01-01T12:00:01Z ERROR request_id=2 status=500 exception=ValueError. Describe edge cases and how your implementation handles gzipped logs and malformed lines.

EasyTechnical
22 practiced

Given these simplified application logs:

2025-05-01T10:12:01Z [INFO] Start request id=abc123 user=42
2025-05-01T10:12:01Z [ERROR] Database timeout after 30s query='SELECT * FROM orders WHERE id=?' id=42
2025-05-01T10:12:02Z [INFO] End request id=abc123 status=504

What is the most likely cause of the error, and what is your first investigative step? Explain what you would check in the database and the application to reproduce and isolate the timeout.

Unlock Full Question Bank

Get access to all 40 Debugging and Systematic Troubleshooting interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.