ThoughtWorks Interview Questions
Global tech consultancy renowned for engineering excellence across Bangalore, Pune, Chennai, and Hyderabad. Interviews are rigorous — expect clean code, TDD, SOLID principles, microservices design, and Java. Pair-programming exercises are common alongside system design rounds.
#1Explain the SOLID principles.
#2How does HashMap work internally?
#3What is the difference between HashMap and ConcurrentHashMap?
#4Explain Java Memory Model: Heap, Stack, and Metaspace.
#5What is the volatile keyword in Java?
#6What is the difference between synchronized and ReentrantLock?
#7What is a deadlock and how do you prevent it?
#8Explain the Stream API and intermediate vs terminal operations.
#9What is garbage collection? How does G1 differ from ZGC?
#10What is the Java ClassLoader hierarchy?
#11What are Java records (Java 16+)?
#12What is the Executor framework and when would you use it over raw Threads?
#13What is the difference between composition and inheritance?
#14What is a marker interface? Give examples.
#15What are the design patterns most commonly asked in Java interviews?
#16How do you implement a Singleton in Java correctly?
#17What is the contract between equals() and hashCode()?
#18What is the difference between fail-fast and fail-safe iterators?
#19What is CopyOnWriteArrayList and when should you use it?
#20How does PriorityQueue work and when would you use it?
#21What is the happens-before relationship in Java Memory Model?
#22What is the difference between sleep(), wait(), and yield()?
#23What are atomic classes (AtomicInteger, AtomicReference)? How do they work?
#24What is a CountDownLatch vs CyclicBarrier?
#25What is a ThreadLocal and what are its dangers?
#26What is a CompletableFuture and how does it improve async programming?
#27What are virtual threads (Project Loom, Java 21)?
#28How does the JIT (Just-In-Time) compiler work?
#29What is the difference between minor GC, major GC, and full GC?
#30What tools do you use to diagnose JVM memory issues?
#31What is the String pool and how does string interning work?
#32What is type erasure in Java generics?
#33What is the difference between <? extends T> and <? super T>?
#34What are sealed classes (Java 17)?
#35What is pattern matching for instanceof (Java 16)?
#36What is the difference between map() and flatMap() in streams?
#37What is the difference between Comparable and Comparator?
#38What is Stream.collect() and what are common Collectors?
#39What is try-with-resources and how does it work?
#40What is exception chaining and why is it important?
#41What is the difference between Java IO and NIO?
#42What is Java Serialization and what are its pitfalls?
#43What is reflection in Java and when is it used?
#44What is the difference between deep copy and shallow copy?
#45What is autoboxing and unboxing? What are the performance implications?
#46What are enums in Java and what advanced features do they support?
#47What is the difference between static and instance initializer blocks?
#48What are Java modules (Java 9 — JPMS)?
#49What is the difference between an inner class, static nested class, and anonymous class?
#50What are the new switch expressions (Java 14)?
#51What is the difference between Runnable, Callable, and Future?
#52How do you handle NullPointerException in Java?
#53What is the difference between Deque and Queue?
#54What is a WeakHashMap and when would you use it?
#55What is the difference between checked and unchecked exceptions — best practices for APIs?
#56What is the difference between interface default methods and abstract class methods?
#57What are the best practices for writing clean Java code?
#58What is a race condition and how do you prevent it?
#59What is the difference between HashMap.computeIfAbsent() and getOrDefault()?
#60What is the purpose of the transient keyword?
#61What is method hiding in Java?
#62What are the Java 8 Date/Time APIs and why were they introduced?
#63What is the difference between HashMap.put() and HashMap.putIfAbsent()?
#64What is an immutable class and how do you create one?
#65What is the covariant return type in Java?
#66What is the difference between Predicate.and(), Predicate.or(), and Predicate.negate()?
#67What is the Observer pattern and how is it implemented in Java?
#68What is the Strategy pattern in Java?
#69What is String.intern() and when should you use it?
#70What are the key differences between Java 8, 11, 17, and 21?
#71What is an API Gateway and what does it do?
#72How do microservices communicate?
#73What is service discovery in microservices?
#74What is the Circuit Breaker pattern and how does it prevent cascading failures?
#75What is distributed tracing and why is it important?
#76What is the Strangler Fig pattern for microservices migration?
#77What is a sidecar pattern?
#78How do you manage configuration in microservices?
#79What are the 12-Factor App principles?
#80What is event-driven architecture and when should you use it?
#81What is the difference between orchestration and choreography in Saga?
#82How do you test microservices effectively?
#83What is a service mesh and when should you use one?
#84How do you ensure data consistency across microservices?
#85What is the circuit breaker pattern?
#86What is service discovery and how does it work?
#87What is the Bulkhead pattern?
#88What is the Retry pattern and how do you implement it safely?
#89What is the difference between choreography and orchestration in Sagas?
#90What is the Backend for Frontend (BFF) pattern?
#91How do you implement distributed tracing?
#92What is the Strangler Fig pattern for migrating a monolith?
#93What is eventual consistency and how do you design for it?
#94How do you version microservice APIs?
#95What is the Sidecar pattern?
#96What is a dead letter queue and why is it important?
#97How do you implement health checks in microservices?
#98What is the Outbox pattern and how does it guarantee event delivery?
#99What is idempotency and how do you implement it in microservices?
#100What are the 12-Factor App principles?
#101How do you handle secrets management in microservices?
#102What is the Ambassador pattern in microservices?
#103How do you implement inter-service authentication?
#104What is the Throttling pattern and how does it differ from rate limiting?
#105What is CQRS and how does it apply to microservices?
#106How do you test microservices?
#107What is service isolation and why is it important?
#108What is an Event-Driven Architecture?
#109How do you handle database per service in practice?
#110What is the Role of API composition in microservices?
#111What is graceful degradation in microservices?
#112What is the Event Sourcing pattern?
#113How do you implement logging in a microservices environment?
#114What is the two-phase commit vs Saga for distributed transactions?
#115How do you handle timeouts in microservices?
#116What is the Scatter-Gather pattern?
#117What is the difference between a microservice and a nanoservice?
#118How do you implement canary deployments in microservices?
#119What is a Service Registry?
#120What is blue-green deployment and how does it work?
#121What is the Aggregator pattern?
#122How do microservices handle configuration management?
#123What is the Proxy pattern in microservices?
#124How do you implement distributed locking in microservices?
#125What is Kafka and why is it popular in microservices?
#126How do you manage service dependencies in microservices?
#127What is a bounded context?
#128How do you implement a request-reply pattern over async messaging?
#129What is the Token Bucket algorithm and how is it used for rate limiting?
#130How do you handle schema evolution in event-driven systems?
#131What is the difference between a monolith, microservices, and modular monolith?
#132What is the Choreography pattern in detail?
#133What is a composite microservice?
#134How do you deal with "chatty" microservices?
#135What is a process manager / workflow engine in microservices?
#136How do you implement zero-downtime deployments for microservices?
#137What is the Anti-Corruption Layer pattern?
#138What are the common pitfalls of microservices adoption?
#139What is the difference between orchestration and choreography?
#140How do you implement a consistent read across microservices?
#141What is load shedding?
#142What is the difference between gRPC and REST for inter-service communication?
#143What is the Gateway Aggregation pattern vs Gateway Routing?
#144What is the Inbox pattern?
#145How do you handle versioning of events in Kafka?
#146What is the Open Host Service pattern?
#147How do you implement service-level SLOs in microservices?
#148What is the Claim Check pattern?
#149What is service mesh traffic management?
#150What is the difference between horizontal and vertical scaling for microservices?
#151What is the role of a message schema registry?
#152How do you handle service discovery with Kubernetes?
#153How do you implement an API gateway from scratch?
#154What is consumer-driven contract testing (Pact)?
#155How do you use feature toggles in microservices?
#156What is polyglot persistence in microservices?
#157What are distributed caching strategies for microservices?
#158How do you design a CI/CD pipeline for microservices?
#159How do you implement observability with Micrometer, Prometheus, and Grafana?
#160What is the Retry pattern and when should you NOT retry?
#161How do you implement Saga compensation (rollback) in detail?
#162What is multi-tenancy in microservices and how do you implement it?
#163What are the steps to migrate a monolith to microservices using the Strangler Fig pattern?
#164How do you design microservices for failure?
#165What is data mesh and how does it relate to microservices data ownership?
#166What is a sidecar proxy and how does Envoy work?
#167How do you handle inter-service authorization (not just authentication)?
#168When should you NOT use microservices?
#169Explain the CAP theorem.
#170What is consistent hashing and why is it used?
#171What is database sharding and how does it work?
#172Explain cache invalidation strategies.
#173How would you design a URL shortener (like bit.ly)?
#174What is the Saga pattern in microservices?
#175What is CQRS and when should you use it?
#176What are rate limiting algorithms?
#177What is the Circuit Breaker pattern?
#178How do you design for high availability?
#179What is eventual consistency?
#180What is a message queue and when should you use one?
#181What is the difference between SQL and NoSQL databases?
#182How do you handle distributed transactions without 2PC?
#183How would you design a notification system (push, email, SMS)?
#184What is the difference between REST and gRPC?
#185What is the Outbox Pattern?
#186How do you design a distributed cache layer?
#187What is the difference between synchronous and asynchronous communication in microservices?
#188How do you design a notification system that sends 100M notifications per day?
#189What are the different types of database indexes and when do you use each?
#190How would you design a URL shortener like bit.ly?
#191What is eventual consistency and how do you handle it in practice?
#192How do you design a search system at scale?
#193What is the difference between optimistic and pessimistic locking?
#194How would you design a real-time leaderboard?
#195What is a write-ahead log (WAL) and how is it used?
#196How do you handle distributed transactions across microservices?
#197How do you design a chat application like WhatsApp?
#198What is a service mesh and when should you use one?
#199How would you design a video streaming platform like YouTube?
#200What is the difference between a load balancer and an API gateway?
#201How do you prevent and handle cascading failures in distributed systems?
#202What is the difference between a message queue and a message broker?
#203How do you design a rate limiter for an API?
#204What is the difference between replication and partitioning in databases?
#205How would you design Twitter's news feed?
#206What is observability and what are its three pillars?
#207How do you implement idempotency in APIs?
#208How would you design a distributed job scheduler?
#209What is the Saga pattern vs 2PC for distributed transactions?
#210How do you design a file storage system like Dropbox?
#211What are the trade-offs of microservices vs monolithic architecture?
#212How does DNS work and how is it used in load balancing?
#213What is the strangler fig pattern?
#214How do you design an e-commerce inventory system that handles flash sales?
#215What is the difference between push and pull architectures for data?
#216How do you design a fraud detection system?
#217What is event sourcing and how does it differ from CRUD?
#218How would you design a geospatial service like Uber's nearby driver system?
#219What is API versioning and what are the different strategies?
#220What is a Bloom filter and where is it used in system design?
#221How do you implement zero-downtime deployments?
#222What is the two-generals problem and what does it tell us about distributed systems?
#223How do you design a payment processing system?
#224How would you design an autocomplete system?
#225What is backpressure and how do you handle it?
#226What is a time-series database and when should you use one?
#227What is a circuit breaker and how do you implement it?
#228How do you handle database migrations safely in production?
#229What is the CQRS pattern?
#230How do you secure an API at the architecture level?
#231What is the difference between synchronous replication and asynchronous replication?
#232How do you design a system for billions of events per day (analytics pipeline)?
#233What is chaos engineering and how do you implement it?
#234What is the database connection pool and how do you tune it?
#235How do you design an access control system?
#236How would you design an online code execution system like LeetCode?
#237How does the request flow work in a typical microservices architecture?
#238What is a hot partition problem and how do you solve it?
#239How do you design a multi-tenant SaaS architecture?
#240What is tail latency and why does it matter?
#241How do you design a global, low-latency key-value store?
#242What is the N+1 query problem and how do you fix it?
#243How would you design a booking system like Airbnb?
#244How do you design a recommendation system?
#245What is the read-your-own-writes consistency guarantee?
#246How do you design a search-as-you-type / typeahead feature?
#247What is the difference between gRPC unary, server streaming, client streaming, and bidirectional streaming?
#248How do you handle large file uploads efficiently?
#249What are the key considerations when designing for high write throughput?
#250What is the difference between monolithic and microservices deployment strategies?
#251How do you design for disaster recovery?
#252What is the thundering herd problem?
#253What is a vector clock and how does it work?
#254What is the difference between a monorepo and polyrepo?
#255How do you ensure data consistency across microservices?
#256What is the difference between a batch job and a stream processing job?
#257How do you design an API for mobile clients vs web clients?
#258What is the role of a message broker in event-driven architecture?
#259How do you approach capacity planning for a new system?
#260What is auto-configuration in Spring Boot?
#261Explain @Transactional and its propagation levels.
#262How does Spring Boot handle exceptions globally?
#263What is the difference between @Bean and @Component?
#264Explain Spring Bean scopes.
#265What is Spring AOP and where is it used?
#266What is circular dependency and how do you fix it?
#267How does Spring Security authentication work?
#268What is @Async in Spring Boot and how does it work?
#269What is Spring Data JPA and how does it simplify data access?
#270How does Spring Boot externalized configuration work?
#271What is Spring Cache Abstraction and how do you use it?
#272How do you write integration tests in Spring Boot?
#273What is the Spring ApplicationContext and how does it differ from BeanFactory?
#274What is a BeanPostProcessor and when would you use it?
#275What is the @PostConstruct and @PreDestroy lifecycle?
#276What is @Qualifier and when do you need it?
#277How does Spring Boot auto-configuration work under the hood?
#278What is @ConfigurationProperties and how does it differ from @Value?
#279What is Spring Boot's embedded server and how do you switch from Tomcat to Undertow?
#280What is Spring's @EventListener and ApplicationEvent?
#281What is @Conditional and how do you create custom conditions?
#282How do you implement request validation in Spring Boot?
#283What is ResponseEntity and when should you use it?
#284What is content negotiation in Spring MVC?
#285How do you implement pagination and sorting in Spring Boot?
#286What is HATEOAS and does Spring Boot support it?
#287How do you version a REST API in Spring Boot?
#288What is the difference between findById() and getById() in Spring Data JPA?
#289What are JPA entity states (Transient, Managed, Detached, Removed)?
#290What is the difference between @OneToMany with fetch LAZY vs EAGER?
#291What is Hibernate first-level cache and second-level cache?
#292What is the Open Session in View (OSIV) pattern and why is it controversial?
#293What is a Spring Data JPA Specification and when would you use it?
#294What is CSRF and how does Spring Security handle it?
#295How do you implement JWT authentication in Spring Boot?
#296What is the difference between @Secured, @PreAuthorize, and @RolesAllowed?
#297What is CORS and how do you configure it in Spring Boot?
#298What is OAuth2 and how does Spring Security support it?
#299What is MockMvc and how do you use it?
#300What is @MockBean vs @Mock in Spring Boot tests?
#301What is @DataJpaTest and how does it differ from @SpringBootTest?
#302What is Testcontainers and how does it improve Spring Boot tests?
#303What is Micrometer and how does it integrate with Spring Boot Actuator?
#304How do you implement custom health indicators in Spring Boot?
#305How do you implement distributed tracing in Spring Boot?
#306What is graceful shutdown in Spring Boot and how do you configure it?
#307What is a Filter vs HandlerInterceptor in Spring Boot?
#308What is @ControllerAdvice and how does it work?
#309What is Spring WebFlux and how does it differ from Spring MVC?
#310What is Spring's @Scheduled and how do you configure it?
#311What happens during Spring Boot startup?
#312What is Spring Boot's fat JAR and how is it structured?
#313What is Spring Retry and how do you use it?
#314What is Spring Integration vs Spring Batch?
#315What is @Transactional readOnly = true and what does it optimize?
#316What is the difference between Spring @Repository exception translation and JDBC exceptions?
#317How do you handle file uploads in Spring Boot?
#318What is Spring Cloud and its key components?
#319What is the difference between @Transactional on a class vs a method?
#320What is Spring Boot's connection pool? How do you tune HikariCP?
#321What is Spring Boot's auto-configuration for messaging (RabbitMQ / Kafka)?
#322What is Spring's @Lookup annotation?
#323What is Spring Security's method security and how is it different from URL security?
#324How does Spring Boot handle environment-specific properties?
#325What is the purpose of @EnableJpaAuditing?
#326How do you implement rate limiting in Spring Boot?
#327What is the difference between eager and lazy initialization in Spring Boot?
#328What is Spring Boot's support for caching with Redis?
#329What is Spring Boot's support for MongoDB?
#330What is @Transactional self-invocation problem and how do you fix it?
#331What is the difference between @Valid and @Validated in Spring?
#332What is Spring Boot's support for scheduled tasks with Quartz?
#333What is Spring Data REST and how does it differ from Spring MVC?
#334What is Flyway and how does it integrate with Spring Boot?
#335What is Spring Boot's support for WebSockets?
#336How do you implement a multi-tenant application in Spring Boot?
#337What are Spring Boot's management endpoints and how do you secure them?
#338What is Spring Boot's support for R2DBC (reactive database access)?
#339How do you implement idempotency in Spring Boot APIs?
#340What is Spring Boot's support for virtual threads (Java 21)?
#341What is Spring Boot's Docker image building support?
#342What is GraalVM native image and Spring Boot AOT support?
#343What is the difference between @SpringBootTest(webEnvironment) options?
#344What is Spring Boot's support for SSE (Server-Sent Events)?
#345What is Resilience4j and how does it integrate with Spring Boot?
#346What are best practices for Spring Boot application performance tuning?