Senior Software Engineer Interview Questions and Answers

Senior interviews are less about the right answer and more about how you decide. Expect open-ended questions where you must state assumptions, compare options, name the costs of each and explain what you would measure.

  1. Q1Senior (5+ years)JavaScript
    How do you find and fix memory leaks in JavaScript?

    Take heap snapshots in Chrome DevTools before and after the suspect action, compare what grew, and fix the retaining reference, which is usually a forgotten listener, timer, global variable or unbounded cache.

  2. Q2Senior (5+ years)React
    Why does a React component re-render and how do you prevent unnecessary re-renders?

    A component re-renders when its state changes, its parent re-renders, or a context it consumes changes; you prevent wasted renders by moving state down, using React.memo, and keeping props referentially stable.

  3. Q3Senior (5+ years)React
    How do you optimize performance in a React application?

    Measure first with the Profiler and Lighthouse, then reduce unnecessary renders, split code with lazy loading, virtualise long lists, and optimise images and bundle size.

  4. Q4Senior (5+ years)HTML & CSS
    What are Core Web Vitals and how do you improve them?

    Core Web Vitals are Google’s field metrics for real-user experience: LCP (loading), INP (interactivity) and CLS (visual stability). They influence search ranking and are measured on real devices, not only Lighthouse.

  5. Q5Senior (5+ years)TypeScript
    What are mapped types and conditional types in TypeScript?

    Mapped types build a new object type by looping over keys (`{ [K in keyof T]: ... }`). Conditional types pick a result with `T extends U ? X : Y`, which is how many utility types are implemented.

  6. Q6Senior (5+ years)SQL
    What are transaction isolation levels in SQL and what problems do they prevent?

    Isolation levels (Read Uncommitted, Read Committed, Repeatable Read, Serializable) control how much concurrent transactions can see of each other's changes, trading consistency against concurrency to prevent dirty reads, non-repeatable reads and phantom reads.

  7. Q7Senior (5+ years)SQL
    How do you optimize a slow SQL query?

    Read the execution plan with EXPLAIN to find full scans and expensive joins, add or fix indexes for the filter and join columns, select only the columns and rows you need, and rewrite predicates so indexes can be used.

  8. Q8Senior (5+ years)C#
    How do you avoid deadlocks with async/await in C#?

    Use async all the way down instead of blocking on tasks with .Result or .Wait(), and in library code use ConfigureAwait(false) so continuations do not need to return to a captured context.

  9. Q9Senior (5+ years)Java
    What is the difference between synchronized and volatile in Java, and how do you avoid deadlocks?

    synchronized gives mutual exclusion and memory visibility for a block of code, while volatile only guarantees that reads and writes of one variable are visible to all threads and does not make compound operations such as count++ atomic.

  10. Q10Senior (5+ years)Python
    What is the GIL in Python and how does it affect multithreading?

    The Global Interpreter Lock (GIL) in CPython lets only one thread execute Python bytecode at a time, so threads do not speed up CPU-bound code but still help with I/O-bound work.

  11. Q11Senior (5+ years)Python
    What is the difference between threading, multiprocessing and asyncio in Python?

    Threading runs concurrent threads that share memory and suit blocking I/O, multiprocessing runs separate processes to use multiple CPU cores for CPU-bound work, and asyncio runs many non-blocking tasks cooperatively on one thread for high-volume I/O.

  12. Q12Senior (5+ years)Node.js
    How do you scale a Node.js application and avoid blocking the event loop?

    Keep the main thread free by moving CPU-heavy work to worker threads or a job queue, and scale across cores and machines by running multiple processes (cluster or PM2) behind a load balancer with shared, external state.

  13. Q13Senior (5+ years)System Design
    How do you design a URL shortener like bit.ly?

    Generate a short unique code for each long URL (for example by base62-encoding a unique ID), store the mapping in a key-value or relational database, serve redirects through a cache because reads far outnumber writes, and record analytics asynchronously.

  14. Q14Senior (5+ years)System Design
    What is the CAP theorem and what does it mean in practice?

    The CAP theorem says that during a network partition a distributed system must choose between consistency (every read sees the latest write) and availability (every request gets a response); you cannot have both while the partition lasts.

  15. Q15Senior (5+ years)System Design
    What is the difference between database sharding and replication?

    Replication copies the same data to several servers to improve read capacity and availability, while sharding splits the data across servers so each holds only a part, which increases write capacity and total storage.

  16. Q16Senior (5+ years)System Design
    Monolith vs microservices: which should you choose?

    Start with a well-structured monolith unless you have several teams and clear service boundaries, because microservices add distributed-system complexity such as network failures, data consistency and operational overhead.