20 of 20 questions shown
Role and technical questions
When would you use an array and when would you use a linked list?
What they’re checking: Whether you understand how memory layout drives time complexity for access, insertion and deletion, not just textbook definitions of both structures.
Sample answer
An array stores elements in contiguous memory, so reading index i is O(1) and it is cache-friendly, which makes iteration fast in practice. Inserting or deleting in the middle is O(n) because elements shift. A linked list stores nodes with pointers, so inserting or deleting is O(1) once I have the node, but finding the node is O(n) and there is no random access. I would use an array or a resizable list for most cases, like storing scores I read often. I would use a linked list for things like an LRU cache, where a doubly linked list plus a hash map gives O(1) moves.
- How would you detect a cycle in a linked list?
- How does a resizable array like an ArrayList grow?
How does a hash map work internally, and what happens on a collision?
What they’re checking: Whether you know why lookups are O(1) on average, what makes them slow in the worst case, and how resizing works behind the scenes.
Sample answer
A hash map runs the key through a hash function to get an integer, then takes it modulo the number of buckets to pick a bucket. Lookup, insert and delete are O(1) on average. A collision is when two keys land in the same bucket. The common fix is chaining, where each bucket holds a small list of entries, or open addressing, where we probe for the next free slot. When the load factor crosses a limit, often 0.75, the table doubles and all keys are rehashed. With a bad hash function everything piles into one bucket and operations degrade to O(n).
- Why must keys be immutable?
- How would you implement an LRU cache?
What is the time complexity of binary search, and when can you use it?
What they’re checking: Whether you can reason about complexity and recognise when a problem has a sorted or monotonic property that allows binary search beyond simple arrays.
Sample answer
Binary search is O(log n) time and O(1) space in the iterative version, because each step halves the search range. It needs a sorted array or, more generally, a monotonic condition, where the answer is false up to some point and true after it. That second use is powerful: I have used it to find the minimum capacity a ship needs to deliver packages within D days, by binary searching over capacity and checking feasibility. Common bugs are integer overflow in the midpoint, so I write low plus (high minus low) divided by two, and off-by-one errors in loop bounds.
- Find the first and last position of a target in a sorted array.
- Can binary search work on a rotated array?
Design a URL shortener.
What they’re checking: Your system design approach: clarifying requirements, estimating scale, choosing storage and key generation, and handling read-heavy traffic with caching.
Sample answer
I would first confirm requirements: create short links, redirect fast, optional expiry, and roughly how many new links and redirects per day. It is heavily read-dominant. For keys, I would use a counter-based unique ID from a distributed ID generator, encoded in base62, so seven characters give over three trillion combinations with no collision checks. Storage can be a key-value store mapping short code to long URL. Redirects go through a cache like Redis in front, since popular links are hit repeatedly, and return 301 or 302 depending on whether we need click analytics. Analytics events go to a queue, not the redirect path.
- How would you prevent abuse or spam links?
- How would you support custom aliases?
Your database has become the bottleneck. How would you scale the service?
What they’re checking: Whether you apply scaling steps in a sensible order, from cheap fixes to complex ones, and understand the costs of replicas and sharding.
Sample answer
I would first find out why it is slow using slow-query logs and metrics. Often the fix is cheap: adding the right index, removing N+1 queries, or caching hot reads in Redis. Next I would add read replicas and route reads there, accepting slight replication lag for things like dashboards. Connection pooling helps if connections are exhausted. For heavy writes, I would move non-critical work like notifications to a queue. Only if one primary still cannot keep up would I shard, for example by customer ID, because sharding makes joins, transactions and rebalancing much harder to manage.
- How do you handle reads that must see the latest write?
- How do you choose a shard key?
What do you look for when reviewing someone else’s code?
What they’re checking: Whether your reviews improve correctness and maintainability while staying respectful and fast, rather than nitpicking style that tooling should catch.
Sample answer
First I check the change does what the ticket says and handles edge cases: empty input, nulls, failures from external calls and concurrency. Then I look at readability, naming, whether the function does one thing, and whether tests cover the new behaviour. I watch for security issues like unvalidated input and secrets in code, and performance traps like queries inside loops. Formatting I leave to the linter. I phrase comments as questions or suggestions, mark small ones as optional, and approve quickly when it is good. For large pull requests, I ask the author to split them.
- How big should a pull request be?
- How do you handle disagreement in a review?
What is the difference between a process and a thread, and what is a race condition?
What they’re checking: Your grasp of concurrency basics, and whether you can spot shared-state bugs and know standard ways to prevent them.
Sample answer
A process has its own memory space, so processes are isolated and communicate through pipes, sockets or files. Threads live inside one process and share its memory, which makes them lighter but lets them interfere with each other. A race condition happens when the result depends on the timing of threads accessing shared data. The classic case is two threads doing count equals count plus one: both read 10, both write 11, and one update is lost. I would fix it with a lock or mutex, an atomic increment, or by avoiding shared mutable state and passing messages through a queue.
- What is a deadlock and how do you avoid it?
- When is async better than threads?
Explain the CAP theorem and how it affects your design choices.
What they’re checking: Whether you understand consistency and availability trade-offs during network partitions and can apply them to real product decisions.
Sample answer
CAP says a distributed system cannot guarantee consistency, availability and partition tolerance all at once. Since network partitions will happen, the real choice during a partition is between consistency and availability. For a wallet balance or seat booking, I choose consistency: better to reject a request than to sell the same seat twice. For a product catalogue, likes count or feed, I choose availability and accept eventual consistency, so users may briefly see stale data. In practice I also think about latency when there is no partition, since strong consistency across regions adds round trips to every write.
- What is eventual consistency?
- How would you prevent double booking?
How do you decide what to cache and how to keep the cache correct?
What they’re checking: Whether you can use caching to cut latency without serving wrong data, and whether you know common invalidation and stampede problems.
Sample answer
I cache data that is read far more often than it changes and is expensive to compute, like a product page or a user’s permissions. The usual pattern is cache-aside: read from cache, on a miss read the database and store the result with a TTL. On writes I delete the cache key rather than update it, which avoids races between two writers. The TTL is a safety net for any missed invalidation. For very hot keys, I prevent a stampede, where many requests miss at once, by using a lock so only one request rebuilds the value. I never cache anything user-specific under a shared key.
- What is write-through caching?
- How would you choose a TTL?
Explain one design pattern or SOLID principle you have applied in real code.
What they’re checking: Whether you use design principles to solve a concrete problem, rather than reciting definitions or adding abstraction without reason.
Sample answer
In a payments service we supported two gateways, and the checkout code had if-else checks for each gateway spread across many files. Adding a third meant touching all of them. I applied the dependency inversion principle with a strategy pattern: I defined a PaymentGateway interface with charge, refund and verifyWebhook methods, and wrote one class per gateway. Checkout depended only on the interface, and a small factory picked the implementation from config. Adding the third gateway became one new class and a config entry, and it was easy to unit test checkout with a fake gateway.
- When does a pattern become over-engineering?
- What is the open/closed principle?
How do you decide what to unit test, what to integration test, and what to mock?
What they’re checking: Whether your testing is practical and focused on risk, and whether you understand the costs of heavy mocking and slow end-to-end suites.
Sample answer
I unit test pure logic with many branches, like pricing rules, discount calculations or parsers, because those tests are fast and pinpoint failures. Integration tests cover the boundaries that break most often: database queries, API endpoints and queue consumers, run against a real test database in a container. I mock things I do not control or that are slow and costly, such as payment gateways, SMS providers and the clock. I avoid mocking my own internal classes heavily, because then tests only check the implementation. A few end-to-end tests cover the critical paths like signup and checkout.
- What is test coverage good for, and what not?
- How do you deal with flaky tests?
Behavioural questions
Tell me about a code review where you strongly disagreed with the feedback.
What they’re checking: Whether you can separate ego from code, argue with evidence and accept a decision, which is essential for working in shared codebases.
Sample answer
A senior engineer asked me to replace a simple loop with a generic rules engine so future discount types could plug in. I felt it added complexity for a need we did not yet have. I replied in the review with the two known discount types, showed that the loop was 30 lines, and suggested we extract an interface only when a third type arrived. We discussed it on a short call. He agreed to keep it simple but asked me to add tests covering both types, which was fair. Four months later we did add a third type, and the refactor took an afternoon.
- What would you have done if he had insisted?
- How do you give critical feedback yourself?
Walk me through a production incident you handled.
What they’re checking: How you behave under pressure: triage, communication, mitigation before root cause, and whether you drive a blameless follow-up that prevents repeats.
Sample answer
During a sale, our order API latency jumped and error rates rose. I was on call. I first checked dashboards and saw database connections maxed out. To stop the damage, I rolled back that morning’s release, which had added a report query on the primary database. Errors dropped within minutes. I posted updates in the incident channel every fifteen minutes so support could answer customers. In the postmortem we found the query lacked an index and ran on every order. We moved reporting to a read replica, added the index, and added a connection-pool alert.
- How do you decide between rollback and hotfix?
- What goes into a good postmortem?
Tell me about a technical decision you made that turned out to be wrong.
What they’re checking: Self-awareness and judgement: whether you can admit a mistake, explain why it seemed right at the time, and show how you corrected course.
Sample answer
I pushed to split our monolith into six microservices when we had a team of five engineers. It looked cleaner on paper. In practice, every feature touched three services, local setup took an hour, and debugging across network calls slowed us down. After two quarters I raised it in our retro myself and proposed merging four services back into a modular monolith with clear internal boundaries. We kept only the notification service separate because it scaled differently. Delivery speed improved noticeably. Now I tie architecture decisions to team size and real scaling needs, not to what large companies do.
- When do microservices make sense?
- How did you convince the team to reverse it?
Describe how you got productive in a large, unfamiliar codebase.
What they’re checking: How you learn independently, when you ask for help, and whether you can contribute safely before you understand the whole system.
Sample answer
In my internship I joined a team with a Java codebase of several hundred thousand lines. I started by running it locally and following one request, an order status update, from the controller through to the database with a debugger. I wrote notes and a small diagram as I went. I picked small bugs from the backlog first, since each one taught me a different module. I time-boxed being stuck to about an hour before asking my mentor, and I wrote down the answers so I never asked twice. By week four I shipped a feature to add delivery-slot filters.
- How do you decide when to ask for help?
- What did your diagram help you catch?
Tell me about a time you had to choose between shipping fast and doing it properly.
What they’re checking: Whether you can make deliberate trade-offs with business context, and whether you track and repay the technical debt you knowingly take on.
Sample answer
A client needed bulk CSV upload of employee data within a week for their payroll cut-off. The proper design was an async job with progress tracking and row-level error reports. That would take three weeks. I proposed shipping a synchronous upload limited to five thousand rows, with clear validation errors, which covered their current file size. I wrote down the limits in the ticket and created a follow-up task for the async version, which my lead scheduled for the next sprint. The client met their cut-off, and we built the proper version before they grew past the limit.
- How do you track technical debt?
- Have you ever regretted a shortcut?
Tell me about a time you mentored or unblocked a junior engineer.
What they’re checking: Whether you can grow others and raise team output, which is expected of engineers moving towards senior roles.
Sample answer
A new graduate on my team kept getting large pull requests sent back with dozens of comments, and he was losing confidence. I set up two thirty-minute pairing sessions a week for a month. We broke his next feature into four small pull requests, and I reviewed the design with him before he wrote code rather than after. I also shared a short checklist of things our reviewers usually flag. His review rounds dropped from four or five to one or two, and by the third month he was reviewing other people’s code. I learned to review ideas early, not just code late.
- How do you balance mentoring with your own work?
- How do you give feedback that is hard to hear?
HR round questions
What is your current CTC, and what are you expecting?
What they’re checking: Whether you know your worth for the level you are interviewing at and can discuss compensation calmly, including fixed, variable and stock components.
Sample answer
My current CTC is 22 lakh, of which 19 lakh is fixed and the rest is a performance bonus. This role is at the senior engineer level with system design ownership and on-call duties, which is a step up from my current scope. Based on that and on conversations with recruiters for similar roles in Bengaluru, I am expecting around 30 lakh fixed. If there are stock options, I would like to understand the vesting schedule and the valuation basis, because I compare offers on the fixed component first and treat stock as a bonus.
- What if we can only offer 26 lakh fixed?
- Do you have a competing offer?
Are you open to relocating, or to working hybrid from our Hyderabad office?
What they’re checking: Your flexibility on location and work mode, and whether any constraints you state are genuine and clearly explained up front.
Sample answer
Yes, I am open to relocating to Hyderabad. I am currently in Indore, and I have no family constraints that would stop me moving within a month of joining. I actually prefer hybrid over fully remote at this stage, because as a newer engineer I learn much faster sitting with the team during design discussions and debugging sessions. If there is a relocation allowance or temporary accommodation for the first few weeks, that would help, but it is not a condition for me. I would just like to know the expected office days per week.
- When could you move?
- Would you work from a client site if needed?
Why are you looking to leave your current company?
What they’re checking: Whether your reasons are forward-looking and professional, and whether the same issue would make you leave this company too.
Sample answer
I have spent four years at a services company, and I have learned a lot about delivery and working with clients. But most of my projects end at handover, so I rarely see how a system behaves at scale over years or get to own its architecture. I want to work on a product where I own services long term, handle real traffic growth and improve them based on metrics. Your team runs its own platform with millions of daily requests and a strong on-call culture, which is exactly the ownership I am missing now.
- What will you miss about your current job?
- Did you discuss this with your manager?
Practise these questions
Answer them aloud against a timer, then compare with the sample answers.
How to prepare for a software engineer interview
- Practise problems by pattern, such as two pointers, sliding window, BFS and DFS, heaps and DP with memoisation, instead of memorising individual questions.
- Always state time and space complexity before the interviewer asks, and talk through a brute-force approach before optimising it.
- For system design, follow a fixed order: requirements, rough scale estimates, API, data model, high-level diagram, then bottlenecks and trade-offs.
- Prepare two production stories with numbers: an incident you handled and a design decision you made, including what you would change now.
- Before a coding round, rehearse in the same setup the company uses, such as a shared doc or online editor, and test with edge cases aloud.
Skill tests for software engineers
Timed practice tests with answers and explanations, for the written or online round.