20 Software Engineer Interview Questions & Answers (2026)
A curated set of the most common software engineering interview questions — organized by category with real, interview-ready answers. Use these to prepare for your next technical round.
Data Structures & Algorithms
Q: What is the difference between an array and a linked list?
Arrays store elements in contiguous memory, offering O(1) random access by index but O(n) insertion/deletion in the middle. Linked lists store elements as nodes with pointers to the next node, offering O(1) insertion/deletion at a known position but O(n) traversal to reach an element. Choose arrays when random access matters; linked lists when frequent insertion/deletion in the middle is required.
Q: Explain how a hash map works internally.
A hash map uses a hash function to convert a key to an index in an underlying array (bucket). When two keys hash to the same index (collision), the map resolves it via chaining (a linked list at each bucket) or open addressing (probing for the next empty slot). Average case for get/set is O(1); worst case with many collisions is O(n). Python's dict and Java's HashMap are examples.
Q: What is the difference between BFS and DFS?
BFS (Breadth-First Search) explores all neighbors at the current depth before moving deeper — it uses a queue and finds the shortest path in unweighted graphs. DFS (Depth-First Search) goes as deep as possible along one branch before backtracking — it uses a stack (or recursion) and is more memory-efficient for deep graphs. Use BFS for shortest-path problems; DFS for maze/cycle detection and topological sort.
Q: What is dynamic programming and when do you use it?
Dynamic programming (DP) breaks a problem into overlapping sub-problems and stores their solutions to avoid redundant computation (memoization or tabulation). Use DP when the problem has: (1) optimal substructure — optimal solution builds on optimal sub-solutions, and (2) overlapping subproblems — the same sub-problems recur. Classic examples: Fibonacci, Knapsack, Longest Common Subsequence, Coin Change.
Q: What is the time complexity of quicksort and when does it degrade?
Quicksort's average time complexity is O(n log n). It degrades to O(n²) in the worst case when the pivot is always the smallest or largest element — which happens with already-sorted arrays if you always pick the first element as pivot. Randomized pivot selection or the median-of-three strategy mitigates this. Quicksort is usually preferred over merge sort for in-memory sorting due to better cache performance.
Object-Oriented Programming
Q: Explain the four principles of OOP.
Encapsulation: bundling data and methods that operate on it, hiding internal state. Abstraction: exposing only what's necessary, hiding implementation details. Inheritance: deriving new classes from existing ones to reuse and extend behavior. Polymorphism: the ability of different objects to respond to the same interface — method overriding (runtime) and overloading (compile-time).
Q: What is the difference between an abstract class and an interface?
An abstract class can have both abstract methods (no implementation) and concrete methods (with implementation). It can hold state (fields). A class can extend only one abstract class. An interface defines a contract — all methods are abstract by default (in most languages). A class can implement multiple interfaces. Use abstract classes when sharing behavior; use interfaces when defining a contract multiple unrelated classes can fulfill.
Q: What is SOLID?
SOLID is five principles for maintainable OOP: Single Responsibility (a class does one thing), Open/Closed (open for extension, closed for modification), Liskov Substitution (subclasses can replace parent without breaking behavior), Interface Segregation (no client should depend on methods it doesn't use), Dependency Inversion (depend on abstractions, not concretions). Following SOLID reduces coupling and makes code easier to test and extend.
Databases
Q: What is indexing in a database and when should you use it?
An index is a data structure (typically a B-tree) that improves query speed by letting the database find rows without scanning every row. Create indexes on columns used frequently in WHERE clauses, JOIN conditions, and ORDER BY clauses. Avoid over-indexing — each index slows down writes (INSERT/UPDATE/DELETE) since the index must be updated. Partial indexes and composite indexes can optimize specific query patterns.
Q: Explain the difference between SQL and NoSQL databases.
SQL databases (PostgreSQL, MySQL) use structured tables, enforce schemas, support ACID transactions, and excel at complex queries with JOINs. NoSQL databases (MongoDB, DynamoDB, Cassandra) are schema-flexible, scale horizontally more easily, and optimize for specific access patterns. SQL is generally better for complex relational data; NoSQL for high-volume, low-latency use cases, time-series data, or documents with varying structure.
Q: What is an N+1 query problem?
An N+1 problem occurs when code fetches a list of N items and then makes N additional queries to fetch related data for each item — resulting in N+1 total database queries instead of 1 or 2. This is common in ORMs. The fix is eager loading (JOIN or IN clause) to fetch related data in bulk. N+1 problems significantly hurt performance at scale.
System Design
Q: What is the difference between horizontal and vertical scaling?
Vertical scaling adds more resources (CPU, RAM) to an existing machine — simpler but has physical limits and creates a single point of failure. Horizontal scaling adds more machines to distribute load — more complex but theoretically unlimited and more resilient. Modern distributed systems favor horizontal scaling with load balancers, sharding, and stateless services.
Q: What is a REST API?
REST (Representational State Transfer) is an architectural style for APIs using standard HTTP methods: GET (read), POST (create), PUT/PATCH (update), DELETE (remove). REST APIs are stateless — each request contains all information needed to process it. Resources are identified by URLs, and responses are typically JSON. REST is widely used for web services due to simplicity and compatibility with HTTP caching and infrastructure.
Behavioral
Q: Tell me about a time you had to debug a difficult production issue.
Use the STAR method. Describe the incident (Situation), your role in resolving it (Task), the specific steps you took — logs, metrics, reproduction, hypothesis, fix (Action), and the outcome including what you put in place to prevent recurrence (Result). Interviewers evaluate your debugging methodology, calm under pressure, and whether you learn from incidents.
Q: How do you handle disagreements with team members about technical decisions?
Explain your process: listen to understand their reasoning, present your position with data or trade-off analysis, and seek alignment through discussion. If the team still disagrees, support the group decision while documenting your concerns. Show that you can disagree without creating conflict and that you prioritize team cohesion and shipping over being right.
Q: Describe a project you're most proud of and why.
Choose a project with meaningful technical depth and impact. Structure your answer: what the problem was, what you built, what was technically challenging, what you learned, and what outcome it had. Be specific with numbers when possible. The 'why proud' part should go beyond just 'it worked' — mention a technical challenge overcome, a team dynamic you navigated, or a real user problem solved.
Q: Tell me about a time you had to learn a new technology quickly.
Share a specific example where you picked up an unfamiliar technology under time pressure. Describe your approach to learning it — documentation, tutorials, building a small prototype, asking colleagues. Emphasize the outcome and what you'd do differently. Interviewers want to know you can learn autonomously and adapt to new stacks.
Q: Where do you see yourself in five years?
Be genuine but frame your answer around growth in the role you're applying for. Avoid 'I want your job' or vague answers. Instead: 'I want to grow into a senior engineer who can own systems end-to-end and mentor junior team members. I see this role as a strong foundation for that path given [specific thing about the company].' Show ambition and alignment with the company.
Practice with AI interview prep
Resumly generates personalized question sets based on your resume and target role. Get AI feedback on your answers and build a day-wise preparation plan.
Start interview prepMore interview guides
Frequently Asked Questions
What topics are covered in a software engineering interview?
Software engineering interviews typically cover: data structures (arrays, linked lists, trees, graphs, hash maps), algorithms (sorting, searching, dynamic programming), object-oriented programming principles, database concepts (SQL, indexing, normalization), system design fundamentals, and behavioral questions about past experience and teamwork.
How many rounds does a software engineering interview have?
Most software engineering interviews involve 3–6 rounds: an initial phone screen with a recruiter, one or two technical coding rounds, a system design round (for senior roles), and a behavioral or cultural fit round. FAANG companies typically have 5–6 rounds on the same day (onsite or virtual).
What is the best way to practice for coding interviews?
Practice on LeetCode, HackerRank, or similar platforms, but focus on understanding patterns rather than memorizing solutions. Group problems by type (two-pointer, sliding window, BFS/DFS, dynamic programming) and master each pattern. Do mock interviews where you talk through your solution out loud, as communication is evaluated just as much as correctness.
How important is system design in software engineer interviews?
System design is typically introduced at mid-level (3+ years) and becomes critical at senior levels. Junior engineers may get simplified versions. Focus on understanding how to break down a large system into components, discuss trade-offs, and explain your choices — not on having a perfect answer.
How should I prepare for behavioral questions in software engineer interviews?
Use the STAR method (Situation, Task, Action, Result) and prepare specific stories from your past projects. Common themes include: a time you resolved a conflict, dealt with ambiguity, led a project, made a mistake and recovered, or pushed back on a decision. Review your resume and prepare a story for every major project or role listed.