Capgemini Interview Questions
One of the largest IT services companies with major centres in Mumbai, Pune, Bangalore, and Chennai. Interviews cover core Java, Spring Boot REST APIs, microservices, and cloud (Azure/AWS). SQL optimisation and Docker basics are commonly tested.
#1What is the difference between == and .equals() in Java?
#2What is the difference between abstract class and interface?
#3Explain the SOLID principles.
#4How does HashMap work internally?
#5What is the difference between HashMap and ConcurrentHashMap?
#6Explain Java Memory Model: Heap, Stack, and Metaspace.
#7What is the volatile keyword in Java?
#8What are functional interfaces and lambda expressions in Java 8?
#9What is Optional and when should you use it?
#10Explain the Stream API and intermediate vs terminal operations.
#11What is the difference between checked and unchecked exceptions?
#12What is the difference between String, StringBuilder, and StringBuffer?
#13What is method overloading vs method overriding?
#14What is the difference between final, finally, and finalize?
#15What are Java records (Java 16+)?
#16What is the Executor framework and when would you use it over raw Threads?
#17What is encapsulation and how is it achieved in Java?
#18What is polymorphism? Explain runtime vs compile-time polymorphism.
#19What is the difference between composition and inheritance?
#20What is a marker interface? Give examples.
#21What are the design patterns most commonly asked in Java interviews?
#22What is the difference between ArrayList and LinkedList?
#23What is the difference between HashSet, LinkedHashSet, and TreeSet?
#24What is the difference between HashMap and TreeMap?
#25What is the contract between equals() and hashCode()?
#26What is the difference between fail-fast and fail-safe iterators?
#27What is CopyOnWriteArrayList and when should you use it?
#28How does PriorityQueue work and when would you use it?
#29What is the difference between sleep(), wait(), and yield()?
#30What are atomic classes (AtomicInteger, AtomicReference)? How do they work?
#31What is a CountDownLatch vs CyclicBarrier?
#32What is the difference between JDK, JRE, and JVM?
#33What is the String pool and how does string interning work?
#34What are sealed classes (Java 17)?
#35What is pattern matching for instanceof (Java 16)?
#36What are text blocks (Java 15)?
#37What is the difference between map() and flatMap() in streams?
#38What are method references in Java 8?
#39What is the difference between Comparable and Comparator?
#40What is Stream.collect() and what are common Collectors?
#41What is try-with-resources and how does it work?
#42What is the difference between throw and throws?
#43What is exception chaining and why is it important?
#44What is the difference between Java IO and NIO?
#45What is reflection in Java and when is it used?
#46What is the difference between deep copy and shallow copy?
#47What is autoboxing and unboxing? What are the performance implications?
#48What are enums in Java and what advanced features do they support?
#49What is the difference between static and instance initializer blocks?
#50What is the difference between String.format() and String.formatted()?
#51What is the var keyword (Java 10) and when should you use it?
#52What is the difference between an inner class, static nested class, and anonymous class?
#53What are the new switch expressions (Java 14)?
#54What is the difference between Runnable, Callable, and Future?
#55What is the difference between String.equals() and String.equalsIgnoreCase()?
#56What is the difference between Iterator and ListIterator?
#57What is the difference between abstract class and concrete class?
#58How do you handle NullPointerException in Java?
#59What is the Collections utility class? What are its most important methods?
#60What is the difference between Deque and Queue?
#61What is the difference between checked and unchecked exceptions — best practices for APIs?
#62What is the ternary operator and the null-coalescing equivalent in Java?
#63What is the difference between == null check and Objects.isNull()?
#64What is the difference between interface default methods and abstract class methods?
#65What is the difference between Iterable and Iterator?
#66What are the best practices for writing clean Java code?
#67What is the difference between a process and a thread in Java?
#68What is a race condition and how do you prevent it?
#69What is the difference between HashMap.computeIfAbsent() and getOrDefault()?
#70What is the purpose of the transient keyword?
#71What is the difference between i++ and ++i in Java?
#72What are the Java 8 Date/Time APIs and why were they introduced?
#73What is the difference between HashMap.put() and HashMap.putIfAbsent()?
#74What is the difference between String.valueOf() and toString()?
#75What is an immutable class and how do you create one?
#76What is the covariant return type in Java?
#77What is the difference between static and instance methods?
#78What is the difference between Predicate.and(), Predicate.or(), and Predicate.negate()?
#79What is the Observer pattern and how is it implemented in Java?
#80What is the Strategy pattern in Java?
#81What are the key differences between Java 8, 11, 17, and 21?
#82What is auto-configuration in Spring Boot?
#83What is @SpringBootApplication and what does it do?
#84What is IoC (Inversion of Control) and Dependency Injection?
#85What is the difference between @Component, @Service, and @Repository?
#86What is the difference between @Controller and @RestController?
#87How does Spring Boot handle exceptions globally?
#88What is Spring Boot Actuator?
#89What is the difference between @Bean and @Component?
#90Explain Spring Bean scopes.
#91How do you configure Spring profiles?
#92What is @Async in Spring Boot and how does it work?
#93What is Spring Data JPA and how does it simplify data access?
#94How does Spring Boot externalized configuration work?
#95What is Spring Cache Abstraction and how do you use it?
#96What are Spring Boot starters and why are they useful?
#97How do you write integration tests in Spring Boot?
#98What is the Spring ApplicationContext and how does it differ from BeanFactory?
#99What is the @PostConstruct and @PreDestroy lifecycle?
#100What is @Qualifier and when do you need it?
#101What is @ConfigurationProperties and how does it differ from @Value?
#102What is Spring Boot's embedded server and how do you switch from Tomcat to Undertow?
#103What is Spring's @EventListener and ApplicationEvent?
#104What is Spring Boot DevTools?
#105What is the difference between @RequestParam, @PathVariable, and @RequestBody?
#106How do you implement request validation in Spring Boot?
#107What is ResponseEntity and when should you use it?
#108What is content negotiation in Spring MVC?
#109How do you implement pagination and sorting in Spring Boot?
#110How do you version a REST API in Spring Boot?
#111What is the difference between findById() and getById() in Spring Data JPA?
#112What is the difference between @OneToMany with fetch LAZY vs EAGER?
#113What is CSRF and how does Spring Security handle it?
#114What is the difference between @Secured, @PreAuthorize, and @RolesAllowed?
#115What is CORS and how do you configure it in Spring Boot?
#116What is MockMvc and how do you use it?
#117What is @MockBean vs @Mock in Spring Boot tests?
#118What is @DataJpaTest and how does it differ from @SpringBootTest?
#119What is Testcontainers and how does it improve Spring Boot tests?
#120What is Micrometer and how does it integrate with Spring Boot Actuator?
#121How do you implement custom health indicators in Spring Boot?
#122What is graceful shutdown in Spring Boot and how do you configure it?
#123What is @ControllerAdvice and how does it work?
#124What is Spring's @Scheduled and how do you configure it?
#125What is CommandLineRunner and ApplicationRunner?
#126What is Spring Boot's banner and how can you customize it?
#127What is Spring Retry and how do you use it?
#128What is @Transactional readOnly = true and what does it optimize?
#129How do you handle file uploads in Spring Boot?
#130What is the difference between @RequestMapping and specific mapping annotations?
#131What is the difference between @Transactional on a class vs a method?
#132What is Spring Boot's connection pool? How do you tune HikariCP?
#133What is Spring Boot's auto-configuration for messaging (RabbitMQ / Kafka)?
#134How does Spring Boot handle environment-specific properties?
#135What is the purpose of @EnableJpaAuditing?
#136What is the difference between eager and lazy initialization in Spring Boot?
#137What is Spring Boot's support for caching with Redis?
#138What is Spring Boot's support for MongoDB?
#139What is the difference between @Valid and @Validated in Spring?
#140What is Spring Data REST and how does it differ from Spring MVC?
#141What is the difference between @Inject and @Autowired?
#142What is Flyway and how does it integrate with Spring Boot?
#143What are Spring Boot's management endpoints and how do you secure them?
#144What is Spring Boot's Docker image building support?
#145What is the difference between @SpringBootTest(webEnvironment) options?
#146What is Spring Boot's support for SSE (Server-Sent Events)?
#147What are the different types of SQL JOINs?
#148How does indexing work in MySQL (InnoDB)?
#149What is a covering index?
#150How do you use EXPLAIN to analyze a query?
#151What are CTEs (Common Table Expressions) and when should you use them?
#152What is the N+1 query problem and how do you fix it?
#153What is a deadlock in MySQL and how does it occur?
#154What is the difference between DELETE, TRUNCATE, and DROP?
#155What is database normalization?
#156What is GROUP BY vs HAVING in SQL?
#157What is a stored procedure and when should you use it?
#158What is the difference between UNION and UNION ALL?
#159What is the difference between a clustered and a non-clustered index?
#160How does MySQL handle AUTO_INCREMENT?
#161What are covering indexes and how do they improve performance?
#162What is the EXPLAIN output and how do you read it?
#163What are database triggers and when should you avoid them?
#164What is a foreign key constraint and what are its performance implications?
#165What is the difference between CHAR and VARCHAR?
#166How do you implement full-text search in MySQL?
#167What is the difference between MyISAM and InnoDB?
#168What are MySQL stored procedures and when should you use them?
#169How do you perform a slow query analysis in MySQL?
#170What is the difference between HAVING and WHERE?
#171What is MySQL's query cache and why was it removed?
#172How do you back up a MySQL database without downtime?
#173What is the difference between optimistic and pessimistic locking in MySQL?
#174What is the difference between IN, EXISTS, and JOIN for subqueries?
#175How do you implement pagination in MySQL efficiently?
#176What are the different types of JOINs in MySQL?
#177What is the difference between a view and a materialized view?
#178What are common MySQL performance anti-patterns?
#179What is a generated column in MySQL?
#180What are the best practices for MySQL schema design?
#181How do you use MySQL's JSON column type?
#182What is ProxySQL and how is it used?
#183How do you detect and fix index fragmentation in MySQL?
#184What are the MySQL 8.0 improvements over MySQL 5.7?
#185How do you design a schema for audit logging?
#186What is the difference between COUNT(*), COUNT(1), and COUNT(col)?
#187How do you implement soft delete in MySQL?
#188What is the difference between CHAR, VARCHAR, TEXT, and BLOB?
#189What is the difference between schema-on-write and schema-on-read?
#190How do you handle time zones in MySQL?
#191What is the difference between a unique constraint and a unique index?
#192How do you monitor MySQL in production?
#193What are window functions and how do you use them?
#194What is the difference between a primary key and a unique key?
#195How do you use MySQL's event scheduler?
#196What is the EXPLAIN ANALYZE command?
#197How do you handle database connection failures in application code?
#198What is the MySQL query execution order?
#199How do you scale MySQL reads?
#200What is the difference between row-based and statement-based replication?
#201How do you use CTEs (Common Table Expressions) effectively?
#202What is the difference between TRUNCATE, DELETE, and DROP?
#203How do you implement optimistic locking with versioning in MySQL?
#204What are the different ways to copy a table in MySQL?
#205What is the purpose of the information_schema?
#206How do you implement full-table search across millions of rows efficiently?
#207What is the max_connections parameter and how do you tune it?
#208What is the difference between ROLLUP and CUBE in SQL?
#209How do you handle NULL values in MySQL queries?
#210What is the difference between a read and a write transaction?
#211What is the mysql.user table and how does MySQL authentication work?
#212What are MySQL's data types for storing money?
#213What is the difference between DATETIME and TIMESTAMP in MySQL?
#214What are microservices and what problems do they solve?
#215What is an API Gateway and what does it do?
#216How do microservices communicate?
#217What is service discovery in microservices?
#218What is the Circuit Breaker pattern and how does it prevent cascading failures?
#219What is distributed tracing and why is it important?
#220What is the Strangler Fig pattern for microservices migration?
#221How do you manage configuration in microservices?
#222What are the 12-Factor App principles?
#223What is event-driven architecture and when should you use it?
#224How do you test microservices effectively?
#225What is the circuit breaker pattern?
#226What is service discovery and how does it work?
#227What is the Bulkhead pattern?
#228What is the Retry pattern and how do you implement it safely?
#229What is the Backend for Frontend (BFF) pattern?
#230How do you implement distributed tracing?
#231What is the Strangler Fig pattern for migrating a monolith?
#232How do you version microservice APIs?
#233What is the Sidecar pattern?
#234What is a dead letter queue and why is it important?
#235How do you implement health checks in microservices?
#236What are the 12-Factor App principles?
#237What is the Ambassador pattern in microservices?
#238What is the Throttling pattern and how does it differ from rate limiting?
#239How do you test microservices?
#240What is service isolation and why is it important?
#241What is an Event-Driven Architecture?
#242What is the Role of API composition in microservices?
#243What is graceful degradation in microservices?
#244How do you implement logging in a microservices environment?
#245How do you handle timeouts in microservices?
#246What is the Scatter-Gather pattern?
#247What is the difference between a microservice and a nanoservice?
#248How do you implement canary deployments in microservices?
#249What is a Service Registry?
#250What is blue-green deployment and how does it work?
#251What is the Aggregator pattern?
#252How do microservices handle configuration management?
#253What is the Proxy pattern in microservices?
#254What is Kafka and why is it popular in microservices?
#255What is the difference between a monolith, microservices, and modular monolith?
#256What is a composite microservice?
#257How do you deal with "chatty" microservices?
#258What is the Anti-Corruption Layer pattern?
#259What are the common pitfalls of microservices adoption?
#260What is the difference between orchestration and choreography?
#261What is load shedding?
#262What is the difference between gRPC and REST for inter-service communication?
#263What is the Gateway Aggregation pattern vs Gateway Routing?
#264What is the Open Host Service pattern?
#265How do you implement service-level SLOs in microservices?
#266What is the Claim Check pattern?
#267What is the difference between horizontal and vertical scaling for microservices?
#268What is the role of a message schema registry?
#269How do you handle service discovery with Kubernetes?
#270What is the Publisher-Subscriber (Pub-Sub) pattern?
#271How do you use feature toggles in microservices?
#272What is polyglot persistence in microservices?
#273What is the Retry pattern and when should you NOT retry?
#274When should you NOT use microservices?
#275What is Docker and how does it differ from a VM?
#276What is the difference between a Docker image and a container?
#277Explain the difference between CMD and ENTRYPOINT in a Dockerfile.
#278What is a multi-stage build and why is it important?
#279What are Docker volumes and when would you use bind mounts instead?
#280Explain Docker networking modes.
#281How do you reduce Docker image size?
#282How does Docker layer caching work?
#283What is Docker Compose and when would you use it?
#284What is a Docker health check?
#285How do you handle logging in Docker containers?
#286What is the difference between docker stop and docker kill?
#287How do you debug a running Docker container?
#288What is Docker Swarm and how does it compare to Kubernetes?
#289What are Docker labels and how are they used?
#290What is the .dockerignore file and why is it important?
#291What are Docker ARG and ENV and how do they differ?
#292What is the difference between COPY and ADD in a Dockerfile?
#293How do you set resource limits on Docker containers?
#294What is a Docker registry and how do you set up a private one?
#295What is WORKDIR in a Dockerfile and why should you use it?
#296How does Docker handle container restart policies?
#297What is the principle of container immutability and how do you implement it?
#298How do you handle environment-specific configuration in Docker?
#299What is a multi-platform Docker image and how do you build one?
#300What is the difference between EXPOSE and port publishing in Docker?
#301How do you troubleshoot a container that won't start?
#302How do you use Docker for local database development?
#303How do you use Docker exec and what are common use cases?
#304What is a Dockerfile SHELL instruction?
#305How do you use Docker Compose for integration testing?
#306What is Docker image tagging strategy?
#307What is the difference between CMD in shell form vs exec form?
#308What is a Docker context?
#309How do you scan Docker images for vulnerabilities?
#310How do you implement service-to-service communication with Docker Compose?
#311What are Docker Compose profiles?
#312How do you monitor Docker containers?
#313How do you use Docker volumes for persistent data and backups?
#314What is a distroless image and when should you use it?
#315How do you cache dependencies effectively for different languages in Docker?
#316What is the Docker container lifecycle?
#317What is COPY --chown and how do you set file permissions in Dockerfile?
#318What is Docker's garbage collection and how do you manage disk space?
#319What is Docker Desktop and how does it differ from Docker Engine?
#320How do you implement health-dependent startup ordering in Docker Compose?
#321How do you share data between containers in Docker?
#322What is Podman and how does it compare to Docker?
#323How do you handle configuration management across multiple Docker environments?
#324What is the difference between docker commit and building from Dockerfile?
#325How do you configure the Docker daemon (dockerd)?
#326What is the Docker build context and how does it affect build performance?
#327How do you use Docker with GitHub Actions for CI/CD?
#328What is the Docker Compose watch feature and how does it improve developer experience?
#329What is image layer sharing and how does it save storage?
#330What is Docker Scout and how does it improve supply chain security?
#331How do you run stateful applications in Docker?
#332How do you handle log rotation and disk usage for Docker container logs?
#333What are Docker's best practices for production deployments?
#334How do you optimize Docker for Node.js applications?
#335What is Docker's host network mode and when should you use it?
#336What is an SBOM and how do you generate one for Docker images?
#337What is a multi-container application pattern vs microservices in Docker?
#338How do you implement service health checks and readiness probes in production?
#339What are the limits of Docker and when should you move to Kubernetes?