Perimattic
Interview questions

Software engineer interview questions: 28 questions with answer outlines

Fundamentals, system design, behavioral and situational questions for software engineer roles, each with what the interviewer looks for and how to structure a strong answer.

28 questionsEntry to seniorLanguage-neutral

Last updated 22 October 2026

Two people working on computer code at monitors in a bright office workspace
Overview

What do software engineer interviews test?

Software engineer interviews test fundamentals and judgment: data structures and their complexity, algorithms, concurrency, databases and system design basics, plus how you test, debug and review code. Expect a coding round, a design discussion for mid and senior roles, and behavioral questions about hard bugs, feedback, mistakes and working with other people.

Question list

What are the top 28 software engineer interview questions?

Every question below is listed here with its type and level, then answered in full in the sections that follow. Select a question to jump to its answer outline.

#QuestionTypeLevel
1Compare an array (or dynamic array) with a linked list. When would you use each?TechnicalEntry
2How does a hash map work, and what are its time complexities?TechnicalEntry
3What does Big O notation describe, and what is the complexity of binary search?TechnicalEntry
4Which sorting algorithms do you know, and what are their trade-offs?TechnicalMid
5Explain BFS and DFS. Which data structure does each use, and when do you choose one?TechnicalEntry
6When would you use a heap or priority queue? Give an example.TechnicalMid
7What is the difference between a process and a thread?TechnicalEntry
8What are race conditions and deadlocks, and how do you prevent them?TechnicalMid
9What is the difference between a mutex and a semaphore?TechnicalMid
10Which HTTP methods are idempotent, and why does idempotency matter in API design?TechnicalMid
11How do you choose between a relational database and a NoSQL store?TechnicalMid
12What does a database index do, and what does it cost?TechnicalMid
13Design a URL shortener at a high level.Design and practiceMid
14Where would you add caching in a system, and how do you handle invalidation?Design and practiceMid
15What is the difference between vertical and horizontal scaling, and what does a load balancer do?Design and practiceEntry
16What does the CAP theorem say, and how does it affect design?Design and practiceSenior
17How do you decide what to unit test, integration test and end-to-end test?Design and practiceMid
18What do you look for when reviewing someone else’s code?Design and practiceMid
19Walk me through how you debug a bug you cannot reproduce locally.Design and practiceMid
20Tell me about the hardest bug you have fixed.BehavioralMid
21Describe a time you received critical feedback on your work. How did you respond?BehavioralEntry
22Tell me about a technical decision you made that turned out to be wrong.BehavioralSenior
23Give an example of helping a teammate grow or get unblocked.BehavioralMid
24Tell me about a time two stakeholders wanted conflicting things from your team.BehavioralSenior
25You are given a feature with vague requirements and a tight deadline. What do you do first?SituationalEntry
26Your change has just caused errors in production. What do you do?SituationalMid
27A colleague asks you to review a 3,000-line pull request by the end of the day. How do you handle it?SituationalMid
28How would you convince your manager to spend time paying down technical debt?SituationalSenior
Fundamentals

Which computer science fundamentals do interviewers ask about?

These questions are language-neutral. Complexities are for the standard textbook structures; say so if a specific library behaves differently.

1. Compare an array (or dynamic array) with a linked list. When would you use each?

Level: Entry. What the interviewer looks for: Correct time complexities and awareness of cache locality, not just textbook claims.

How to answer:

  • Array: O(1) access by index, amortized O(1) append to a dynamic array, O(n) insert or delete in the middle.
  • Linked list: O(1) insert or delete once you hold the node, but O(n) to find it and no index access.
  • Arrays are contiguous, so they are cache-friendly and usually faster in practice; linked lists suit frequent splicing, queues and LRU caches (with a hash map).

2. How does a hash map work, and what are its time complexities?

Level: Entry. What the interviewer looks for: Hashing, collisions, resizing, and average versus worst case.

How to answer:

  • A hash function maps a key to a bucket; collisions are handled by chaining or open addressing.
  • Lookup, insert and delete are O(1) on average; the worst case is O(n) when many keys collide.
  • The table resizes when the load factor grows, which is O(n) for that operation but amortized O(1).
  • Keys must be hashable and their hash must not change while in the map.

3. What does Big O notation describe, and what is the complexity of binary search?

Level: Entry. What the interviewer looks for: Growth rate as input size increases, and the sorted-input requirement for binary search.

How to answer:

  • Big O describes an upper bound on how running time or memory grows with input size, ignoring constants.
  • Binary search halves the search range each step: O(log n) time, but only on sorted data with random access.
  • Mention that constants and real data sizes still matter when choosing between algorithms.

4. Which sorting algorithms do you know, and what are their trade-offs?

Level: Mid. What the interviewer looks for: Average and worst cases, stability and memory, plus knowing what standard libraries use.

How to answer:

  • Comparison sorts cannot beat O(n log n) in the worst case.
  • Merge sort: O(n log n) always, stable, needs O(n) extra memory. Quicksort: O(n log n) on average, O(n²) worst case, in place, not stable.
  • Many standard libraries use hybrids, for example Timsort (stable, used by Python and for object arrays in Java).
  • Non-comparison sorts like counting or radix sort can be linear for bounded integer keys.

5. Explain BFS and DFS. Which data structure does each use, and when do you choose one?

Level: Entry. What the interviewer looks for: Queue for BFS, stack or recursion for DFS, and BFS for shortest paths in unweighted graphs.

How to answer:

  • BFS explores level by level using a queue; it finds the shortest path by edge count in an unweighted graph.
  • DFS goes deep first using a stack or recursion; useful for cycle detection, topological sort and exploring all paths.
  • Both are O(V + E) with an adjacency list; track visited nodes to avoid infinite loops.

6. When would you use a heap or priority queue? Give an example.

Level: Mid. What the interviewer looks for: Operation costs and a fitting use case such as top-k or scheduling.

How to answer:

  • A binary heap gives O(1) peek at the min or max, and O(log n) insert and remove.
  • Use cases: top-k items (keep a heap of size k), merging sorted streams, task scheduling, Dijkstra’s algorithm.
  • Building a heap from n items takes O(n).

7. What is the difference between a process and a thread?

Level: Entry. What the interviewer looks for: Memory isolation versus shared memory, and the cost and risk implications.

How to answer:

  • A process has its own address space; threads within a process share memory and resources.
  • Threads are cheaper to create and communicate through shared memory, which needs synchronization.
  • Processes are isolated, so a crash in one does not corrupt another, but communication needs IPC.

8. What are race conditions and deadlocks, and how do you prevent them?

Level: Mid. What the interviewer looks for: Clear definitions and practical prevention techniques.

How to answer:

  • A race condition: the result depends on the timing of concurrent operations on shared state, for example two threads incrementing a counter.
  • Prevent with locks, atomic operations, immutable data, or by confining state to one thread or message passing.
  • A deadlock: threads wait on each other forever. It needs mutual exclusion, hold-and-wait, no preemption and circular wait.
  • Prevent by acquiring locks in a consistent global order, using timeouts, and holding locks briefly.

9. What is the difference between a mutex and a semaphore?

Level: Mid. What the interviewer looks for: Exclusive ownership versus counting permits, with a use case for each.

How to answer:

  • A mutex allows one holder at a time and is normally released by the thread that acquired it.
  • A counting semaphore allows up to N concurrent holders, for example limiting connections to a database to 10.
  • A binary semaphore looks like a mutex but has no ownership concept, so it can be used for signaling between threads.

10. Which HTTP methods are idempotent, and why does idempotency matter in API design?

Level: Mid. What the interviewer looks for: Correct method semantics and the link to safe retries.

How to answer:

  • GET, HEAD, PUT and DELETE are idempotent: repeating the same request leaves the server in the same state. POST is not; PATCH is not guaranteed to be.
  • Idempotency makes retries safe after timeouts and network failures.
  • For non-idempotent operations such as payments, accept an idempotency key so duplicate requests are processed once.

11. How do you choose between a relational database and a NoSQL store?

Level: Mid. What the interviewer looks for: Choosing by data shape, consistency needs and query patterns, not by trend.

How to answer:

  • Relational: structured data with relationships, transactions and flexible ad hoc queries.
  • NoSQL (document, key-value, wide-column, graph): specific access patterns, very high write scale, or flexible schemas.
  • Default to a relational database unless a specific need points elsewhere; many systems use both.

12. What does a database index do, and what does it cost?

Level: Mid. What the interviewer looks for: Faster reads at the expense of writes and storage, and using the query plan to decide.

How to answer:

  • An index (often a B-tree) lets the database find rows without scanning the whole table.
  • Costs: extra storage and slower inserts, updates and deletes because the index must be maintained.
  • Composite index column order matters; check with EXPLAIN that queries actually use the index.
Design and practice

What system design and engineering-practice questions should you expect?

These test how you build and maintain real systems: design trade-offs, testing strategy, reviews and debugging.

13. Design a URL shortener at a high level.

Level: Mid. What the interviewer looks for: Clarifying requirements, a sensible data model and ID scheme, and read-heavy scaling.

How to answer:

  • Clarify scale, custom aliases, expiry and analytics before designing.
  • Generate short codes from a unique ID (for example base62 of a counter or a random code with a collision check) and store code to URL.
  • Reads dominate: put a cache in front of the store and serve redirects (301 or 302, depending on whether analytics needs every hit) from it.
  • Discuss rate limiting, abuse prevention and how the ID generator scales across instances.

14. Where would you add caching in a system, and how do you handle invalidation?

Level: Mid. What the interviewer looks for: Layers of caching and an explicit strategy for staleness.

How to answer:

  • Caches can sit in the client, CDN, application memory or a shared store such as Redis.
  • Common patterns: cache-aside with a TTL, write-through, and explicit invalidation on update.
  • Decide how stale data may be; watch for stampedes when a hot key expires and for inconsistency between cache and database.

15. What is the difference between vertical and horizontal scaling, and what does a load balancer do?

Level: Entry. What the interviewer looks for: Trade-offs of each and the requirement for stateless services.

How to answer:

  • Vertical: a bigger machine. Simple, but has a ceiling and a single point of failure.
  • Horizontal: more machines. Needs stateless services (sessions in a shared store) and a load balancer.
  • The load balancer spreads requests and removes unhealthy instances using health checks.

16. What does the CAP theorem say, and how does it affect design?

Level: Senior. What the interviewer looks for: Correct framing: the trade-off applies during a network partition.

How to answer:

  • In a distributed system, when a network partition occurs you must choose between consistency (every read sees the latest write or an error) and availability (every request gets a response).
  • Partitions cannot be ruled out, so the real choice is how the system behaves when one happens.
  • Mention that latency versus consistency trade-offs also exist without partitions (PACELC) and that many systems let you tune consistency per operation.

17. How do you decide what to unit test, integration test and end-to-end test?

Level: Mid. What the interviewer looks for: A balanced test strategy with fast feedback and confidence where it matters.

How to answer:

  • Many fast unit tests for logic, fewer integration tests for boundaries (database, queues, APIs), a small number of end-to-end tests for critical user journeys.
  • Test behavior, not implementation details, so refactors do not break tests.
  • Every bug fix gets a regression test; flaky tests are fixed or removed, not ignored.

18. What do you look for when reviewing someone else’s code?

Level: Mid. What the interviewer looks for: Priorities in the right order and a respectful, specific tone.

How to answer:

  • First correctness and design: does it do what it should, handle edge cases and fit the architecture?
  • Then tests, security, performance where relevant, and readability; leave style to linters.
  • Comments are specific, explain why, and distinguish blocking issues from suggestions; small PRs get better reviews.

19. Walk me through how you debug a bug you cannot reproduce locally.

Level: Mid. What the interviewer looks for: A hypothesis-driven method using evidence from production.

How to answer:

  • Gather evidence: logs, traces, error reports, the exact inputs, environment and version.
  • Compare environments (config, data, load, time zone) and form hypotheses ranked by likelihood.
  • Add targeted logging or metrics, narrow down with bisecting recent changes, then reproduce in a test before fixing.
Behavioral

Which behavioral questions do software engineers get?

Answer with a real example in the STAR shape: situation, task, action, result. Keep enough technical detail for the interviewer to judge depth.

20. Tell me about the hardest bug you have fixed.

Level: Mid. What the interviewer looks for: A clear STAR story with real technical depth and a lesson.

How to answer:

  • Situation: the system, the symptom and why it was hard (intermittent, cross-team, production-only).
  • Actions: the steps you took, dead ends included, and how you found the root cause.
  • Result: the fix, the test or monitoring you added, and what you now do differently.

21. Describe a time you received critical feedback on your work. How did you respond?

Level: Entry. What the interviewer looks for: Self-awareness and visible change after the feedback.

How to answer:

  • The feedback, who gave it and the context.
  • How you reacted, asked clarifying questions and decided what to change.
  • The change you made and its effect over the following weeks.

22. Tell me about a technical decision you made that turned out to be wrong.

Level: Senior. What the interviewer looks for: Ownership, reasoning at the time, and how you corrected course.

How to answer:

  • The decision, the options you considered and why you chose as you did.
  • When and how you realized it was wrong, and the impact.
  • How you fixed or migrated away from it, and what you now check before similar decisions.

23. Give an example of helping a teammate grow or get unblocked.

Level: Mid. What the interviewer looks for: Teaching rather than taking over, and a result for the teammate.

How to answer:

  • Who needed help and with what.
  • What you did: pairing, explaining the reasoning, pointing to resources, letting them drive.
  • The outcome for them and for the team.

24. Tell me about a time two stakeholders wanted conflicting things from your team.

Level: Senior. What the interviewer looks for: Making trade-offs explicit and escalating with options, not opinions.

How to answer:

  • The two requests and why they conflicted.
  • How you clarified the goals behind each, laid out options and their costs, and involved the right decision-maker.
  • The decision and how everyone was kept informed.
Situational

How should you answer situational software engineering questions?

These are hypothetical. Say what you would do first, why, and who you would involve.

25. You are given a feature with vague requirements and a tight deadline. What do you do first?

Level: Entry. What the interviewer looks for: Asking clarifying questions and delivering a small, verifiable slice.

How to answer:

  • Ask the product owner about the user problem, success criteria and must-haves versus nice-to-haves.
  • Write down assumptions and confirm them; build the smallest useful version first.
  • Show progress early to catch misunderstandings before they are expensive.

26. Your change has just caused errors in production. What do you do?

Level: Mid. What the interviewer looks for: Restoring service first, communicating, then fixing properly.

How to answer:

  • Tell the team or on-call channel and roll back or disable the change behind its flag.
  • Confirm the errors stop, then investigate with the evidence collected.
  • Ship a fix with a test that would have caught it, and share what happened.

27. A colleague asks you to review a 3,000-line pull request by the end of the day. How do you handle it?

Level: Mid. What the interviewer looks for: Being helpful while being honest about review quality.

How to answer:

  • Explain that a careful review of that size will take longer or miss things.
  • Suggest splitting it into smaller PRs, or review the riskiest parts first with the author walking you through it.
  • Agree a plan for the rest and mention smaller PRs for the future.

28. How would you convince your manager to spend time paying down technical debt?

Level: Senior. What the interviewer looks for: Framing debt in business impact and proposing a bounded plan.

How to answer:

  • Quantify the cost: incidents, slow delivery in that area, onboarding time.
  • Propose a specific, time-boxed piece of work with a measurable outcome.
  • Offer options such as a fixed share of each sprint, and report the results afterwards.
Preparation

How should you prepare for a software engineer interview?

WhenWhat to doWhy it helps
1 week beforeSolve a few timed problems a day across arrays, hash maps, trees, graphs and heaps, saying the complexity aloud. Sketch two or three small designs, such as a URL shortener or a rate limiter.Regular, spoken practice builds the habit of explaining while you code.
1 week beforePrepare four or five STAR stories: your hardest bug, a mistake you owned, critical feedback, helping a teammate, a conflict over priorities.One well-prepared story can answer several behavioral questions.
1 day beforeRe-read the job ad and the company’s engineering blog or product. Review the language you will code in, and check your editor, microphone and internet if the interview is remote.You can relate your answers to the problems the team actually has.
During the interviewRestate the problem, ask about constraints and edge cases, start with a simple working approach, then improve it. Test your code with an example before saying you are done.Interviewers score communication and process, not just the final code.
Practice

Where can you practice these software engineering questions?

Use the free mock interview practice tool, already set to software engineer, to answer timed questions and score yourself against a rubric for structure, relevance and depth. To build your own set of questions by level and type, open the interview question generator for software engineers.

Developer working at a desk with code on several monitors
Perimattic

How can Perimattic AI Interview help you prepare?

Perimattic AI Interview runs conversational mock interviews by role and level, with spoken or typed answers and feedback on each answer against a rubric for structure, relevance and depth. Hiring teams can run structured first-round interviews with the same questions for every candidate, with recorded answers and transcripts for human reviewers. People, not the AI, make hiring decisions.

Get started: Sign up and our team will walk you through Perimattic AI Interview for the way you prepare for or run interviews.

FAQs

Software engineer interviews, answered

How much data structures and algorithms practice do I need?

Enough to solve common problems on arrays, strings, hash maps, trees, graphs and heaps in a shared editor while explaining your reasoning and complexity. Steady practice on a mix of easy and medium problems usually matters more than volume. Product companies and startups vary: some replace algorithm puzzles with practical coding or debugging tasks.

Do entry-level software engineers get system design questions?

Sometimes, but at a lighter level: designing a small API, choosing a database, or explaining how caching or a load balancer helps. Deep design rounds are more common for mid and senior roles. For any level, clarify requirements first and talk through trade-offs rather than naming technologies.

How should I answer salary questions in a software engineer interview?

This page does not quote salary figures, because pay varies widely by city, company type and level. Research current ranges for the role and location from recent job postings and salary surveys, give a range rather than a single number, and consider the whole package, including bonus and equity, when comparing offers.

Talk to our team

Want to rehearse software engineering interviews out loud?

Sign up to tell us how you prepare for or run interviews, and our team will get in touch to walk you through Perimattic AI Interview.

Sign up