Senior Full Stack Developer Interview Questions and Answers

Milad Bonakdar
Author
Prepare for senior full stack interviews with practical questions on React, Node.js, architecture, databases, security, DevOps, and production trade-offs.
Introduction
Senior full stack interviews test more than syntax. Expect to explain frontend performance, API design, data modeling, reliability, security, deployment choices, and the trade-offs behind systems you have actually shipped.
Use these questions to rehearse concise answers, then attach each answer to a real project: what you chose, why it fit the constraints, what broke, and what you would improve next.
How to use this guide
- Start with the React, Node.js, authentication, and system design questions because they appear often in senior interviews.
- Turn each answer into a short story from your own work: context, decision, trade-off, result.
- Avoid memorizing tool lists. Senior candidates are judged on judgment, debugging habits, and production ownership.
Frontend Development (6 Questions)
1. Explain React's Virtual DOM and Reconciliation algorithm.
Answer: The Virtual DOM is a lightweight JavaScript representation of the actual DOM. React uses it to optimize updates.
- Process: When state changes, React creates a new Virtual DOM tree and compares it with the previous one (diffing).
- Reconciliation: React's algorithm identifies the minimal set of changes needed and updates only those parts of the real DOM.
- Key Optimization: Using
keyprops helps React identify which items have changed, been added, or removed in lists, making reconciliation more efficient. - Fiber Architecture: Modern React uses Fiber, which allows breaking rendering work into chunks and prioritizing updates.
Rarity: Very Common Difficulty: Medium
2. What are React Hooks and why were they introduced?
Answer: Hooks are functions that let you use state and other React features in functional components.
- Motivation: Before Hooks, stateful logic required class components. Hooks allow reusing stateful logic without changing component hierarchy.
- Common Hooks:
useState: Manages local stateuseEffect: Handles side effects (data fetching, subscriptions)useContext: Accesses context valuesuseMemo/useCallback: Performance optimization
- Custom Hooks: You can create custom hooks to extract and reuse component logic.
Rarity: Very Common Difficulty: Easy
3. How do you optimize React application performance?
Answer: Multiple strategies can improve React performance:
- Measure first: Use React DevTools Profiler and browser performance tools to find slow renders, expensive effects, large bundles, or network waterfalls.
- Reduce unnecessary rendering: Keep state close to where it is used, split context carefully, and use
React.memo()only where props are stable. - Memoize selectively: Use
useMemo()for expensive calculations anduseCallback()when function identity causes real child re-renders. - Load less JavaScript: Use route-level code splitting, dynamic imports, and lazy loading for heavy components.
- Render long lists efficiently: Use virtualization for large tables, feeds, or logs.
- Move work to the right layer: Prefer server rendering, caching, pagination, or API changes when the frontend is doing too much work.
Rarity: Common Difficulty: Medium
4. Explain the difference between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
Answer:
- CSR: The browser downloads JavaScript and renders the UI on the client. It can work well for authenticated app screens, but weak initial HTML can hurt first load and search visibility.
- SSR: The server renders HTML for the request. It usually improves first content and SEO-sensitive pages, but adds server cost and request-time complexity.
- Static generation: Pages are pre-rendered ahead of time. It fits content pages, docs, and marketing pages that do not need per-request personalization.
- Hybrid rendering: Modern frameworks often mix static rendering, server rendering, streaming, and client components. A senior answer should explain the user experience, caching, personalization, and operational trade-offs.
Rarity: Common Difficulty: Medium
5. What is the difference between localStorage, sessionStorage, and Cookies?
Answer:
- localStorage: Persists data with no expiration. ~5-10MB limit. Not sent to server automatically.
- sessionStorage: Same as localStorage but cleared when tab/browser closes.
- Cookies: Small data (~4KB) sent with every HTTP request. Can set expiration. Used for authentication tokens.
- Security: Cookies can be
HttpOnly(not accessible via JS) andSecure(HTTPS only). Use for sensitive data.
Rarity: Common Difficulty: Easy
6. How does CSS-in-JS work and what are its trade-offs?
Answer: CSS-in-JS libraries (styled-components, Emotion) allow writing CSS directly in JavaScript.
- Benefits:
- Scoped styles (no global namespace pollution)
- Dynamic styling based on props
- Automatic vendor prefixing
- Dead code elimination
- Trade-offs:
- Runtime overhead (styles generated at runtime)
- Larger bundle size
- Learning curve
- Alternatives: CSS Modules, Tailwind CSS, traditional CSS with BEM methodology.
Rarity: Medium Difficulty: Medium
Backend Development (6 Questions)
7. Explain the Event Loop in Node.js.
Answer: Node.js is single-threaded but handles concurrency through the event loop.
- Phases:
- Timers: Executes
setTimeoutandsetIntervalcallbacks - Pending callbacks: I/O callbacks deferred to next iteration
- Poll: Retrieves new I/O events, executes I/O callbacks
- Check:
setImmediatecallbacks - Close callbacks: Socket close events
- Timers: Executes
- Non-blocking I/O: When I/O operations are initiated, Node.js delegates them to the system kernel and continues executing other code.
Rarity: Very Common Difficulty: Hard
8. What is Middleware in Express.js?
Answer: Middleware functions have access to the request, response, and next middleware function in the application's request-response cycle.
- Types:
- Application-level:
app.use() - Router-level:
router.use() - Error-handling: Has 4 parameters
(err, req, res, next) - Built-in:
express.json(),express.static() - Third-party:
cors,helmet,morgan
- Application-level:
- Order matters: Middleware executes in the order it's defined.
Rarity: Very Common Difficulty: Easy
9. How do you handle authentication in a REST API?
Answer: Multiple approaches exist:
- JWT (Stateless):
- Server generates signed token containing user info
- Client sends the token with each request, commonly through an authorization header or a secure cookie
- Server verifies signature
- Pros: Scalable, no server-side session storage
- Cons: Harder to revoke before expiry, larger payload, and risky if tokens are exposed in browser storage
- Session-based (Stateful):
- Server creates session, stores in DB/Redis
- Client receives a session ID in a cookie
- Pros: Easier to revoke and rotate centrally
- Cons: Requires server-side storage and session infrastructure
- OAuth 2.0: For third-party authentication
- Best Practice: Use short-lived access tokens, rotate refresh tokens, set
HttpOnly,Secure, andSameSiteon sensitive cookies, protect state-changing routes from CSRF, and never treat JWT payloads as secret.
Rarity: Very Common Difficulty: Medium
10. Explain Database Transactions and ACID properties.
Answer: A transaction is a sequence of operations performed as a single logical unit of work.
- ACID:
- Atomicity: All operations succeed or all fail (all-or-nothing)
- Consistency: Database moves from one valid state to another
- Isolation: Concurrent transactions don't interfere with each other
- Durability: Committed transactions persist even after system failure
- Isolation Levels: Read Uncommitted, Read Committed, Repeatable Read, Serializable (trade-off between consistency and performance).
Rarity: Common Difficulty: Medium
11. What is the difference between SQL and NoSQL databases?
Answer:
- SQL (Relational):
- Structured schema, tables with rows/columns
- ACID compliant
- Vertical scaling (bigger server)
- Examples: PostgreSQL, MySQL
- Use case: Complex queries, transactions, structured data
- NoSQL:
- Flexible schema, document/key-value/graph/column-family
- BASE (Eventually consistent)
- Horizontal scaling (more servers)
- Examples: MongoDB, Redis, Cassandra
- Use case: Rapid development, massive scale, unstructured data
Rarity: Common Difficulty: Easy
12. How do you prevent SQL Injection attacks?
Answer: SQL Injection occurs when user input is directly concatenated into SQL queries.
- Prevention:
- Parameterized Queries/Prepared Statements: Use placeholders for user input
- ORMs: Libraries like Sequelize, TypeORM handle escaping automatically
- Input Validation: Whitelist allowed characters
- Least Privilege: Database user should have minimal permissions
- Stored Procedures: Can provide an additional layer
Rarity: Very Common Difficulty: Easy
System Design & Architecture (6 Questions)
13. How would you design a scalable notification system?
Answer: A notification system needs to handle multiple channels (email, SMS, push) at scale.
- Components:
- API Service: Receives notification requests
- Message Queue: RabbitMQ/Kafka for async processing
- Workers: Separate services for each channel
- Database: Store notification history, user preferences
- Rate Limiting: Prevent spam
- Considerations:
- Retry logic for failures
- Priority queues for urgent notifications
- Template management
- User preferences (opt-out)
Rarity: Common Difficulty: Hard
14. Explain Microservices architecture and its challenges.
Answer: Microservices decompose an application into small, independent services.
- Benefits:
- Independent deployment and scaling
- Technology diversity
- Fault isolation
- Team autonomy
- Challenges:
- Distributed Transactions: Hard to maintain consistency across services
- Network Latency: Inter-service communication overhead
- Monitoring: Need distributed tracing (Jaeger, Zipkin)
- Data Management: Each service owns its database
- Testing: Integration testing is complex
- Patterns: API Gateway, Service Mesh, Circuit Breaker, Saga pattern for transactions.
Rarity: Very Common Difficulty: Hard
15. What is Caching and what are common caching strategies?
Answer: Caching stores frequently accessed data in fast storage to reduce latency.
- Layers:
- Browser cache
- CDN (CloudFlare, Akamai)
- Application cache (Redis, Memcached)
- Database query cache
- Strategies:
- Cache-Aside: App checks cache first, loads from DB on miss
- Write-Through: Write to cache and DB simultaneously
- Write-Behind: Write to cache, async write to DB
- Read-Through: Cache loads data from DB automatically
- Eviction Policies: LRU (Least Recently Used), LFU (Least Frequently Used), TTL (Time To Live).
Rarity: Very Common Difficulty: Medium
16. How do you ensure API versioning?
Answer: API versioning allows backward compatibility when making changes.
- Strategies:
- URI Versioning:
/api/v1/users,/api/v2/users - Header Versioning:
Accept: application/vnd.api.v1+json - Query Parameter:
/api/users?version=1
- URI Versioning:
- Best Practices:
- Deprecation warnings
- Maintain at least 2 versions
- Clear migration guides
- Semantic versioning
- GraphQL Alternative: Schema evolution without versioning (deprecated fields).
Rarity: Common Difficulty: Medium
17. Explain the CAP Theorem.
Answer: In distributed systems, you can only guarantee 2 out of 3:
- Consistency: All nodes see the same data at the same time
- Availability: Every request receives a response (success/failure)
- Partition Tolerance: System continues operating despite network failures
- Reality: Network partitions will happen, so you must choose between CP (Consistency) or AP (Availability).
- Examples:
- CP: MongoDB, HBase (sacrifice availability during partition)
- AP: Cassandra, DynamoDB (eventual consistency)
Rarity: Common Difficulty: Hard
18. What is Load Balancing and what algorithms are used?
Answer: Load balancing distributes traffic across multiple servers.
- Algorithms:
- Round Robin: Sequential distribution
- Least Connections: Send to server with fewest active connections
- IP Hash: Hash client IP to determine server (session persistence)
- Weighted Round Robin: Servers with higher capacity get more requests
- Types:
- Layer 4 (Transport): Based on IP/Port, faster
- Layer 7 (Application): Based on content (URL, headers), smarter
- Tools: Nginx, HAProxy, AWS ELB, Google Cloud Load Balancer.
Rarity: Common Difficulty: Medium
DevOps & Cloud (4 Questions)
19. Explain Docker and containerization benefits.
Answer: Docker packages applications with their dependencies into containers.
- Benefits:
- Consistency: Same environment in dev/staging/prod
- Isolation: Each container is isolated
- Lightweight: Share host OS kernel (vs VMs)
- Fast startup: Seconds vs minutes for VMs
- Portability: Run anywhere Docker is installed
- Components:
- Image: Read-only template
- Container: Running instance of an image
- Dockerfile: Instructions to build an image
- Registry: Docker Hub, private registries
Rarity: Very Common Difficulty: Easy
20. What is CI/CD and why is it important?
Answer:
- Continuous Integration: Developers merge code frequently, automated tests run on each commit
- Continuous Deployment: Automatically deploy to production after passing tests
- Benefits:
- Faster feedback
- Reduced integration problems
- Higher quality code
- Faster time to market
- Tools: Jenkins, GitLab CI, GitHub Actions, CircleCI
- Pipeline Stages: Build → Test → Deploy
- Best Practices: Automated testing, feature flags, rollback mechanisms.
Rarity: Very Common Difficulty: Easy
21. How do you monitor and debug production applications?
Answer: Comprehensive monitoring is critical for production systems.
- Logging:
- Structured logging (JSON format)
- Centralized logging (ELK Stack, Splunk)
- Log levels (ERROR, WARN, INFO, DEBUG)
- Metrics:
- Application metrics (response time, throughput)
- Infrastructure metrics (CPU, memory, disk)
- Tools: Prometheus, Grafana, DataDog
- Tracing:
- Distributed tracing for microservices
- Tools: Jaeger, Zipkin, AWS X-Ray
- Alerting: PagerDuty, Opsgenie for critical issues
- Error Tracking: Sentry, Rollbar for exception monitoring.
Rarity: Common Difficulty: Medium
22. What is Infrastructure as Code (IaC)?
Answer: IaC manages infrastructure through code rather than manual processes.
- Benefits:
- Version control for infrastructure
- Reproducible environments
- Faster provisioning
- Reduced human error
- Tools:
- Terraform: Cloud-agnostic, declarative
- CloudFormation: AWS-specific
- Ansible: Configuration management
- Pulumi: Use programming languages
- Best Practices:
- Store in version control
- Modular, reusable components
- Separate environments (dev/staging/prod)
- Automated testing of infrastructure.
Rarity: Medium Difficulty: Medium
Testing & Best Practices (3 Questions)
23. Explain the Testing Pyramid.
Answer: The testing pyramid represents the ideal distribution of different test types.
- Unit Tests: Test individual functions/components in isolation. Fast, many of them.
- Integration Tests: Test how components work together. Medium speed, moderate number.
- E2E Tests: Test entire user flows. Slow, expensive, few of them.
- Rationale: More unit tests because they're fast and catch bugs early. Fewer E2E tests because they're slow and brittle.
Rarity: Common Difficulty: Easy
24. What are SOLID principles?
Answer: SOLID is an acronym for five design principles:
- S - Single Responsibility: A class should have one reason to change
- O - Open/Closed: Open for extension, closed for modification
- L - Liskov Substitution: Subtypes must be substitutable for their base types
- I - Interface Segregation: Many specific interfaces better than one general
- D - Dependency Inversion: Depend on abstractions, not concretions
- Benefits: More maintainable, testable, and flexible code.
Rarity: Common Difficulty: Medium
25. How do you handle errors in asynchronous JavaScript?
Answer: Multiple patterns exist for async error handling:
- Promises:
- Async/Await:
- Global Error Handlers:
window.addEventListener('unhandledrejection', ...)for unhandled promise rejections- Express error middleware for backend
- Best Practice: Always handle errors, use centralized error handling, log errors properly.
Rarity: Very Common Difficulty: Easy


