Software Engineer interview questions and sample answers

A software engineer interview usually mixes two kinds of question: ones that test whether you know the job, and behavioral ones that ask for proof from your past. Below are 10 of the first with a short model answer, and 5 of the second with what the interviewer is really checking. Rewrite every answer in your own words and with your own numbers.

Job-specific questions

1. How do you approach debugging a production issue with no clear stack trace?

I start by reproducing the issue locally with the same inputs, then add structured logging around the suspected code path. I check recent deploys and git blame for the affected files, and use git bisect across commits to isolate the change.

2. Walk me through how you would review a pull request that changes a shared utility function.

I check every caller of that function first, run the existing test suite, and look for edge cases like null inputs or empty arrays. I also confirm the PR includes updated unit tests before approving.

3. What is your process for writing unit tests for a new feature?

I write tests for the happy path first, then edge cases like empty input, boundary values, and error conditions. I aim for tests that fail for a clear reason, mock external dependencies like databases, and keep each test focused on one behavior.

4. How do you decide between SQL and NoSQL for a new service?

I look at the data's relationships and consistency needs. If I need joins, transactions, and strict schema like an orders table, I use PostgreSQL. If I need flexible schema and high write throughput like event logs, I lean toward DynamoDB or MongoDB.

5. Describe how you would handle a situation where a teammate's code introduced a regression.

I would flag it privately first with the specific failing test and commit hash, not in a public channel. We would pair for ten minutes to find the fix together, then add a regression test so the bug can't slip through again.

6. What steps do you take before merging a large refactor into main?

I break the refactor into smaller PRs when possible, run the full test suite plus a manual smoke test on staging. I also check the CI coverage report didn't drop, and schedule the merge early in the day so I can monitor for issues.

7. How do you handle technical debt when your manager wants features shipped fast?

I log the debt in our backlog with a one-line cost estimate, like skipping caching here adds 200ms latency. Then I negotiate a fixed percentage of each sprint, usually 15 to 20 percent, dedicated to the highest-impact items.

8. Explain how you would design a rate limiter for an API.

I would use a token bucket algorithm backed by Redis, giving each API key a bucket of 100 tokens refilled at 10 per second. Redis's atomic INCR and TTL commands keep it fast and consistent across multiple app servers.

9. How do you approach optimizing a slow database query?

I run EXPLAIN ANALYZE first to see the query plan, then check for missing indexes on the WHERE and JOIN columns. I've fixed queries that ran in 4 seconds down to under 50 milliseconds just by adding a composite index.

10. Tell me about a time you had to push back on a requirement from a product manager.

A PM wanted real-time sync with a 100ms SLA. I explained the network hop alone cost 80ms, and proposed a 2-second polling fallback instead. We shipped the polling version first and revisited true real-time once we had usage data.

Behavioral questions

Answer these with STAR: the Situation in one sentence, the Task, the Action you took (most of the answer), the Result with a number.

11. Tell me about a result you are proud of.

What they are checking: A specific outcome with a number, and what you personally did to get it.

A result to build the answer around: Reduced p99 API latency from 480 ms to 290 ms by adding a read-through cache and rewriting 3 hot queries.

12. Describe a time you improved how something was done.

What they are checking: That you notice waste and fix it without being told, then measure the difference.

A result to build the answer around: Led migration of a monolith to 12 services over 9 months with zero customer-facing downtime.

13. Tell me about a time you had to deliver under pressure.

What they are checking: How you prioritise, communicate early and still finish to standard.

A result to build the answer around: Cut cloud spend by $18k/year by right-sizing Kubernetes workloads and removing idle environments.

14. Give an example of working with a difficult colleague or customer.

What they are checking: Calm, the other person's view stated fairly, and a result that helped both sides.

A result to build the answer around: Mentored 4 junior engineers; two were promoted within a year.

15. What is something you learned from a mistake?

What they are checking: Ownership without excuses, and the habit you changed so it did not happen again.

A result to build the answer around: Introduced contract tests that dropped production incidents from integration bugs by 60%.

Before the interview

Interviewers read your resume just before they walk in, and most questions come from it. Every bullet on it should be one you can expand into a two-minute STAR story. Check that it matches the posting with the free ATS Match Score, and look at the software engineer resume keywords the ad is likely to use.

Turn your notes into a software engineer resume, free

No signup, no card. See the full software engineer resume example and the cover letter example.

Interview questions for related jobs

All interview question lists · CV Forge — free resume generator