Senior Java Full Stack Developer – Advanced Scenario-Based Interview
Questions
This document contains advanced senior-level interview questions focused on Core Java,
Java 8/17/21, Spring Framework, Spring Boot, Microservices, Kafka, GraphQL, Kubernetes,
AWS, Terraform, Production Troubleshooting, Distributed Systems, and Enterprise
Architecture. Questions are designed for 1.5-hour deep technical interviews.
Scenario 1: Production Memory Leak
Your production application running on Java 17 starts crashing every 3–4 days with
[Link]: Java heap space.
The application handles around 20,000 concurrent users. Restart temporarily fixes the
issue, but memory usage continuously increases over time.
How would you investigate and resolve this issue?
Follow-ups:
- What JVM tools would you use first?
- Difference between heap dump and thread dump?
- How would you identify leaking objects?
- Can thread pools cause memory leaks?
- How would you analyze GC logs?
- What happens if Metaspace fills up?
Scenario 2: High CPU Usage Without Increased Traffic
Your microservice suddenly starts consuming 95% CPU even though traffic remains normal.
Pods begin restarting due to failed health checks.
How do you debug this issue?
Follow-ups:
- Which Linux commands would you use?
- How would you identify problematic threads?
- Could infinite loops cause this?
- How does GC impact CPU usage?
- How would you isolate JVM vs DB vs Network issues?
Scenario 3: Parallel Stream Production Failure
A developer converts a sequential stream into a parallel stream to improve performance.
After deployment, CPU usage increases heavily, response times worsen, and DB connections
exhaust.
Why did this happen?
Follow-ups:
- How do parallel streams use ForkJoinPool?
- Why are parallel streams dangerous in web applications?
- What happens if operations are blocking?
- CPU-bound vs IO-bound workloads?
- How would Java 21 virtual threads help?
Scenario 4: @Transactional Not Working
A production bug occurs where data is partially committed even though the method is
annotated with @Transactional.
Explain possible reasons.
Follow-ups:
- Self-invocation issue?
- Checked vs unchecked exceptions?
- Why private methods break transactions?
- How does Spring create transaction proxies?
- How would you verify active transaction boundaries?
Scenario 5: Cascading Failure in Microservices
Service A calls Service B, and Service B calls Service C.
Service C slows down due to database issues.
Soon the entire platform becomes slow, thread pools exhaust, and requests timeout
everywhere.
Explain what happened.
Follow-ups:
- Circuit breaker role?
- Bulkhead pattern?
- Retry storms?
- Timeout configuration?
- Why synchronous communication is risky?
Scenario 6: Duplicate Kafka Messages
Your payment service consumes Kafka events.
Some customers are charged twice because duplicate events were processed.
How do you prevent this?
Follow-ups:
- At-least-once vs exactly-once semantics?
- Idempotency strategies?
- Offset commit timing?
- Consumer rebalance issues?
- Deduplication tables?
Scenario 7: GraphQL API Performance Issue
A GraphQL dashboard query takes 20 seconds in production.
Investigation reveals thousands of DB queries generated and high CPU usage.
Explain the root cause.
Follow-ups:
- N+1 problem?
- DataLoader?
- Query complexity limits?
- GraphQL caching challenges?
- Deep nested query attacks?
Scenario 8: Kubernetes CrashLoopBackOff
Your pod continuously restarts in Kubernetes.
Application logs show nothing useful.
How do you investigate?
Follow-ups:
- Liveness vs readiness probes?
- OOMKilled meaning?
- Resource limits?
- Startup probe?
- kubectl describe usage?
Scenario 9: Database Deadlock
Production application starts failing with intermittent deadlock exceptions during peak
traffic.
How would you investigate?
Follow-ups:
- DB deadlock vs Java deadlock?
- Isolation level impact?
- Row-level vs table-level locks?
- Transaction ordering?
- Detecting deadlocks in Oracle/MySQL?
Scenario 10: Enterprise Modernization
You join a company with a 15-year-old monolith, no observability, manual deployments,
shared database, and frequent outages.
Management asks for modernization.
What would your 12-month roadmap look like?
Evaluate:
- Technical vision
- Risk management
- CI/CD improvements
- Observability strategy
- Microservices migration planning
Rapid Fire Questions
Why HashMap is not thread-safe?
Why self-invocation breaks transactions?
Difference between optimistic and pessimistic locking?
What causes ClassLoader leaks?
Why distributed systems are hard?
What is retry storm?
Explain backpressure.
What is thundering herd problem?
Why REST APIs become slow?
Why GC pauses happen?