Full Stack Developer interview questions
100 real questions with model answers and explanations for Middle candidates.
See a Full Stack Developer resume example →Questions
var, let, and const differ in scope, hoisting, and reassignment.
- var is function-scoped and hoisted, so it leaks outside blocks and causes bugs
- let is block-scoped and allows reassignment
- const is block-scoped and blocks reassignment, though object properties stay mutable
- default to const, use let only when you must reassign, avoid var in modern code
Why interviewers ask this: Tests whether the candidate understands scoping rules and can identify the common pitfall of variables leaking out of loops or if-blocks due to var hoisting.
Node.js runs on a single thread and offloads I/O so it never blocks.
- libuv handles I/O via OS async APIs or a thread pool for blocking work
- completed operations queue their callbacks for the event loop
- the loop processes queues in phases: timers, pending callbacks, poll, check, close
- this lets Node serve thousands of concurrent connections without the main thread waiting
Why interviewers ask this: Reveals whether the candidate understands why Node.js is non-blocking and can reason about callback ordering, which matters when debugging performance issues or unexpected execution sequences.
A closure is a function that keeps access to its outer scope after that function returns.
- it retains outer variables even once the enclosing function has finished
- example: a counter factory returning increment and get that share a private count
- callers cannot touch that private variable directly
- closures power partial application, memoization, and the module pattern
Why interviewers ask this: Tests understanding of lexical scoping and whether the candidate can apply closures to real patterns rather than just reciting the textbook definition.
JavaScript objects inherit directly from other objects through the prototype chain.
- accessing a property walks up the chain until it is found or reaches null
- classical inheritance in Java uses classes as blueprints in a strict hierarchy
- ES6 class syntax is just sugar over prototypes
- it does not change the underlying runtime model
Why interviewers ask this: Separates developers who understand JavaScript's object model from those who learned class-based languages first and apply incorrect mental models when debugging inheritance issues.
async/await is syntactic sugar over Promises for writing async code linearly.
- Promises chain with .then() and .catch(), but deep chains hurt readability
- missed error handling is easy in long chains
- async/await reads like synchronous code and uses try/catch for errors
- under the hood an async function returns a Promise and await pauses until it settles
Why interviewers ask this: Checks whether the candidate understands that async/await and Promises are the same mechanism, which prevents confusion when mixing them or debugging rejected Promises.
WeakMap and WeakSet hold weak references so their entries can be garbage collected.
- the collector can reclaim referenced objects even while they appear in the collection
- ideal for attaching metadata to DOM nodes or objects without blocking cleanup
- unlike Map and Set they are not iterable
- you cannot list or enumerate their contents
Why interviewers ask this: Tests depth of knowledge beyond common data structures and whether the candidate understands how weak references interact with garbage collection.
JavaScript uses mark-and-sweep, freeing everything not reachable from roots.
- it periodically marks objects reachable from globals and the call stack, then frees the rest
- closures holding large objects too long cause leaks
- event listeners added repeatedly without removal leak memory
- unbounded global structures also accumulate; diagnose with heap snapshots or --inspect
Why interviewers ask this: Tests practical awareness of memory management, since middle developers are expected to diagnose and resolve memory leaks in production services rather than just restart the process.
The value of this depends on how a function is called, not where it is defined.
- a regular call points this at the global object, or undefined in strict mode
- a method call points this at the object before the dot
- an arrow function binds this lexically to the surrounding scope
- a common pitfall is losing this when passing a method as a callback, fixed with arrow functions or .bind()
Why interviewers ask this: Reveals whether the candidate understands JavaScript's call-site rules deeply enough to debug the common 'this is undefined' error in callbacks and event handlers.
Each HTTP version reduces head-of-line blocking and latency.
- HTTP/1.1 uses persistent connections but blocks head-of-line, so browsers open many parallel connections
- HTTP/2 adds multiplexing over one connection, header compression, and server push
- HTTP/3 replaces TCP with QUIC, removing connection-level head-of-line blocking
- QUIC lets streams fail independently, cutting latency on lossy networks
Why interviewers ask this: Tests whether the candidate understands protocol evolution and can reason about which version to configure based on infrastructure and performance requirements.
CORS is a browser rule that blocks cross-origin requests unless the server allows them.
- the server permits origins via Access-Control-Allow-Origin and related headers
- requests with custom headers or non-simple methods trigger a preflight OPTIONS first
- the browser proceeds only if the server returns correct Allow headers
- in Express use the cors middleware with an explicit allowlist, not a wildcard in production
Why interviewers ask this: Exposes whether the candidate understands the browser security model versus treating CORS as an error to suppress, which leads to dangerously permissive configurations.
Authentication verifies who you are; authorization verifies what you may do.
- authentication checks identity via credentials or a signed token
- authorization checks permissions, like an admin role before granting access
- confusing them creates security bugs
- example: validating a token but never checking if its user can access the requested resource
Why interviewers ask this: Tests clarity of thinking around security model fundamentals, which is essential for a middle developer building protected APIs where both concerns must be handled independently.
Cookies are transport; sessions and JWTs are two ways to hold user state.
- session auth stores data server-side, often in Redis, and hands the client a session ID
- the server looks up the session on every request
- JWTs encode signed claims on the client, so the server stays stateless and just verifies the signature
- a cookie can carry either; HttpOnly and Secure flags block client-side JavaScript from reading the token
Why interviewers ask this: Tests whether the candidate understands the trade-offs around scalability and revocation rather than blindly preferring one approach based on what they learned first.
Cache-Control and ETag give you time-based and content-based caching.
- Cache-Control sets policy: max-age for lifetime, no-cache to revalidate, no-store to never cache
- ETag is a fingerprint the client returns in If-None-Match next time
- the server then replies 304 Not Modified when content is unchanged
- combining them gives both time-based expiry and a content-based validation fallback
Why interviewers ask this: Practical knowledge expected of middle developers building APIs and SPAs, where poor caching configuration causes either staleness bugs or unnecessary server load.
WebSockets keep a persistent two-way connection; polling repeats short requests.
- a WebSocket upgrades from HTTP to one persistent bidirectional TCP connection
- either side can push data at any time
- long polling holds a request open until data exists, then the client requests again
- WebSockets win for high-frequency two-way traffic like chat; polling is simpler for rare updates
Why interviewers ask this: Tests whether the candidate selects the right real-time strategy based on use case frequency and directionality rather than always reaching for WebSockets.
The browser turns a URL into pixels through DOM, CSSOM, render tree, layout, and paint.
- after DNS and TCP/TLS it downloads HTML and builds the DOM, running CSS and JS as found
- CSS is parsed into the CSSOM and combined with the DOM into the render tree
- the browser calculates layout (reflow) and paints pixels to the screen
- render-blocking scripts delay first paint, so defer non-critical JS and inline critical CSS
Why interviewers ask this: Essential for full-stack developers who need to understand why specific performance optimizations like deferring scripts and inlining critical CSS have measurable impact on Core Web Vitals.
The virtual DOM is React's in-memory copy of the real DOM used to minimize updates.
- on state change React renders a new virtual tree
- it diffs the new tree against the old one via reconciliation
- it applies only the minimal set of real DOM mutations
- this batching and diffing avoids expensive direct DOM work on every change
Why interviewers ask this: Tests foundational React knowledge and whether the candidate understands the performance rationale behind React's design, not just the API surface.
Controlled components drive form values from React state; uncontrolled leave them in the DOM.
- a controlled input's value flows through state and an onChange handler
- an uncontrolled input lets the DOM hold the value, read via a ref when needed
- controlled components are easier to validate, reset, and test
- uncontrolled can help huge forms where re-rendering every keystroke hurts performance
Why interviewers ask this: Reveals whether the candidate understands React's data flow and can choose the right pattern based on form complexity and performance requirements.
Hooks let function components use state and lifecycle features without classes.
- they add React state and lifecycle to function components
- call them only at the top level of a component or custom hook
- never call them inside conditionals, loops, or nested functions
- React relies on call order to match hook state to the right component instance across renders
Why interviewers ask this: Tests whether the candidate understands the implementation rationale behind the Rules of Hooks, which helps them debug unexpected hook behavior rather than just memorizing constraints.
useEffect runs after render, and a dependency array controls when it re-runs.
- by default it runs after every render
- omitting dependencies creates stale closures that capture outdated values
- missing cleanup on subscriptions or timers causes memory leaks
- unnecessary dependencies fire the effect too often and can cause infinite loops
Why interviewers ask this: useEffect is among the most misused hooks; this question reveals whether the candidate has debugged stale closure and cleanup bugs in real projects rather than just read the docs.
useMemo caches a computed value; useCallback caches a function reference.
- useMemo returns the cached result until its dependencies change, skipping expensive recalcs
- useCallback keeps a function from being recreated on every render
- both preserve referential equality between renders
- that matters when passing values to memoized children or using them as hook dependencies
Why interviewers ask this: Tests understanding of referential equality in JavaScript and whether the candidate knows when memoization actually helps versus adding unnecessary complexity to the code.
Locked questions
- 21
How does React reconciliation work and how does the key prop affect it?
react - 22
How would you diagnose and fix a React component that re-renders too frequently?
reactcomponents - 23
When should you use Context API versus a dedicated state management library?
stateapi - 24
How does code splitting with React.lazy and Suspense work and why does it matter?
react - 25
What are the trade-offs between server-side rendering, static site generation, and client-side rendering?
ssr - 26
What is the purpose of useReducer and when does it make more sense than useState?
hooks - 27
How does React 18's concurrent rendering change how you think about component updates?
reactcomponentsconcurrency - 28
What is the difference between process.nextTick and setImmediate in Node.js?
concurrency - 29
How do you handle errors in Express middleware and async route handlers?
middlewareasyncsoft-skills - 30
What is database connection pooling and how do you configure it correctly?
databasepoolingconfig - 31
How would you design a REST API that supports versioning?
restversioningdesign - 32
What are the trade-offs between REST and GraphQL?
restgraphql - 33
How does JWT authentication work and what are the key security considerations?
authjwt - 34
How do you prevent common security vulnerabilities in a Node.js API?
vulnerabilitiesapi - 35
What is the N+1 query problem in GraphQL and how do you solve it?
queriesn+1graphql - 36
How do you implement pagination in a REST API and what are the trade-offs between offset and cursor pagination?
restpagination - 37
How would you implement a background job queue in a Node.js application?
jobs - 38
How do you manage secrets and environment variables securely across environments?
secretsconfig - 39
What is the difference between SQL and NoSQL databases and how do you choose between them?
sqlnosqldatabase - 40
How do database indexes work and what are their trade-offs?
databaseindexes - 41
What is a database transaction and what do the ACID properties guarantee?
databasetransactionsacid - 42
Explain the difference between INNER JOIN, LEFT JOIN, and FULL OUTER JOIN in SQL.
sqljoins - 43
How do you approach optimizing a slow SQL query?
sqlqueriesoptimization - 44
What is database normalization and when is denormalization appropriate?
databasenormalizationdenormalization - 45
What is the CAP theorem and how does it influence database selection?
databasecap - 46
How does MongoDB handle schema validation and what are the trade-offs of a schema-less design?
mongodbschemadesign - 47
What are database migrations and how do you manage them in a team environment?
databasemigrations - 48
How would you design a database schema for a multi-tenant SaaS application?
databaseschemadesign - 49
What is a micro-frontend and when would you introduce one?
micro-frontends - 50
How would you design a caching strategy for a full-stack application?
designcaching - 51
What is event-driven architecture and when does it make sense compared to request-response?
events - 52
How do you approach splitting a monolith into services without creating a distributed monolith?
monolithdistributed - 53
What role does a reverse proxy play in a Node.js production deployment?
proxydeployment - 54
What is horizontal scaling and what must change in your application to support it?
scaling - 55
How do you handle distributed transactions across multiple services?
soft-skillstransactionsdistributed - 56
What is Docker and how does containerization benefit a full-stack development team?
dockercontainers - 57
How do you structure a CI/CD pipeline for a full-stack application?
ci-cd - 58
What is the difference between a Docker image and a Docker container?
dockercontainers - 59
How does Kubernetes differ from Docker Compose and when would you choose each?
dockerkubernetes - 60
How do you monitor a Node.js service in production?
monitoring - 61
What is a CDN and how does it improve frontend performance?
performance - 62
How do you achieve zero-downtime deployments?
deployment - 63
What is infrastructure as code and why does it matter for a middle developer?
- 64
What is the difference between unit tests, integration tests, and end-to-end tests?
unitintegratione2e - 65
How do you test an Express API endpoint?
endpoints - 66
What is mocking in tests and when should you avoid over-mocking?
mocking - 67
How do you debug a memory leak in a Node.js service?
memory - 68
How do you debug a production issue that you cannot reproduce locally?
- 69
How do you ensure database consistency in integration tests?
integrationdatabaseconsistency - 70
What is test-driven development and when does it not make sense to apply it?
- 71
Describe your approach to refactoring a large legacy codebase.
refactoring - 72
How do you decide when to pay down technical debt versus shipping a new feature?
tech-debt - 73
How do you handle a technical disagreement with a team member?
soft-skillsconflict - 74
How do you onboard yourself quickly to an unfamiliar codebase?
onboardinglearning - 75
How do you communicate a breaking API change to teams consuming your service?
communicationapi - 76
How do you estimate development time for a feature you have never built before?
estimation - 77
What makes a good pull request?
code-review - 78
Describe a bug caused by a race condition that you have encountered or can reason through. How would you identify and fix it?
concurrency - 79
How do you stay current with changes in the JavaScript and Node.js ecosystem without being distracted by every new library?
learningjavascript - 80
Describe a time you had to advocate for a technical decision to a non-technical stakeholder.
communication - 81
What does owning a feature mean to you beyond writing the code?
- 82
How would you implement rate limiting in a Node.js API deployed across multiple instances?
rate-limitingdeployment - 83
How do you handle file uploads securely in a Node.js application?
soft-skills - 84
What is the difference between synchronous and asynchronous logging and why does it matter in a high-traffic Node.js service?
loggingasync - 85
How do you design an API for mobile clients that need to minimize data transfer?
designapi - 86
What is CQRS and when is its added complexity justified?
cqrsalgorithms - 87
How do you manage environment-specific configuration across development, staging, and production?
config - 88
What is PostgreSQL full-text search and when would you use Elasticsearch instead?
postgressearch - 89
What happens when a database connection pool is exhausted and how do you prevent it?
databasepooling - 90
How do you approach accessibility when building React components?
reactcomponentsa11y - 91
How does async/await interact with Promise.all and when would you use it?
asyncpromises - 92
What is the purpose of a monorepo and what tools help manage one?
monorepo - 93
How do you implement authentication with OAuth or a third-party identity provider?
authoauth - 94
What is server-sent events (SSE) and how does it compare to WebSockets for real-time updates?
websocketssse - 95
How do you implement optimistic UI updates in a React application?
reactlocking - 96
What is the purpose of database query builders and ORMs, and when is raw SQL preferable?
sqldatabasequeries - 97
How do you handle long-running API requests that might exceed a client timeout?
soft-skillsapi - 98
What is Content Security Policy and how do you configure it for a React application?
reactcspconfig - 99
How do you implement feature flags in a full-stack application?
feature-flags - 100
How do you approach performance profiling of a slow Next.js page?
profilingnextjs