Core Java & OOPS
Core Java & OOPS
1. What is Java and what are its main features?
2. What is Abstraction and how is it achieved in Java?
3. What is the difference between an Abstract class and an Interface?
4. What are the rule changes for exception handling in method overriding?
5. Can we override a static method? If not, why?
6. What is the difference between Method Hiding and Method Overriding?
7. Can a final method be overloaded?
8. What is a Covariant Return Type?
9. What are Marker Interfaces and give some examples?
10.What are the differences between Composition and Aggregation?
11.What are the key Design Principles in Core Java (like SOLID)?
12.What is Java Reflection API and what are its use cases?
13.What is a Wrapper Class in Java?
14.What is Boxing, Autoboxing, and Autounboxing?
15.What is the difference between Java Enum and Constants?
16.What is a Classpath in Java?
17.What are alternative ways of calling the main method?
Memory Management, String &
Garbage Collection
Memory Management, String & Garbage Collection
1. What are the different memory areas of the JVM: Heap, Stack, Method Area, PC
Registers, and Native Memory?
2. In which memory area of the JVM are classes loaded?
3. What is a Static Block and when is it executed?
4. Why is the String class immutable in Java?
5. What is the String Constant Pool (SCP) and how does it work?
6. What is the difference between String, StringBuilder, and StringBuffer?
7. What is the difference between final, finally, and finalize?
8. How does Garbage Collection work in Java?
9. If finalize() is removed in Java 9+, then how does cleanup happen?
10.What is the Cleaner API?
11.What is the try-with-resources statement, and how does it work?
12.How can you create your own custom class that works with try-with-resources?
Java Collections Framework
Java Collections Framework
1. What is the difference between Collection and Collections in Java?
2. What is the difference between an Array and an ArrayList?
3. What is the difference between LinkedList and ArrayList?
4. How does HashMap work internally in Java?
5. How does HashSet work internally to ensure uniqueness?
6. What is the difference between HashMap, Hashtable, and ConcurrentHashMap?
7. What is a Synchronized HashMap and how does it differ from ConcurrentHashMap?
8. We are using a HashMap in our application and facing data loss issues in production;
why does this happen?
9. How can we resolve this HashMap data loss issue without making any code changes on
the production server?
10.What is the difference between fail-fast and fail-safe iterators?
11.What is the Comparable vs Comparator interface?
Concurrency & Multithreading
Concurrency & Multithreading
1. What is multithreading, and how does it work internally?
2. What is the use/purpose of multithreading in applications?
3. Explain the Thread Lifecycle with its different states.
4. What is a Daemon Thread and how is it different from a user thread?
5. What is the difference between run() and start() methods of a Thread?
6. How can you return a value from the run() method of a Runnable (or how to use
Callable)?
7. What is the difference between Callable and Runnable interfaces?
8. What is a Race Condition and how can we prevent it?
9. What is Synchronization in Java and how is it implemented?
10.Why are notify(), notifyAll(), and wait() always used inside a synchronized context?
11.What is the difference between the synchronized keyword and ReentrantLock?
12.What is the purpose of the volatile keyword? When should we use it, and when should
we avoid it?
13.What is the difference between Volatile variables and Atomic variables?
14.What is ThreadLocal and how does it prevent thread-safety issues?
15.What is an Executor Service? What are its advantages and disadvantages?
16.What is a ThreadPoolTaskExecutor and how do you configure it?
17.What is a connection pool, and how does it work?
18.If the main thread is calling multiple child threads, how can a child thread send a
message or data back to the main thread?
Java Modern Features (Java 8 to 21)
Java Modern Features (Java 8 to 21)
1. What are the main new features introduced in recent Java versions?
2. What are Lambda Expressions and how do they benefit Java programming?
3. What is the difference between a Functional Interface and a normal interface?
4. What are Streams in Java and how do they process data?
5. What is the difference between Stream’s map() method and objectToMap conversions?
6. What are Default methods in an interface and why were they introduced?
7. What is the Optional class and how does it help avoid NullPointerExceptions?
8. What is the Diamond Operator and how does it work in type inference?
9. What is a Record class and when should we use it?
10.What are Immutable classes and objects, and how can we create our own custom
immutable class?
Spring Boot & Database (JPA /
Hibernate)
Spring Boot & Database (JPA / Hibernate)
1. What is Spring Boot and how does it differ from the core Spring Framework?
2. Why is Spring Boot not always preferred for every type of application?
3. What is Dependency Injection (DI) and how is it implemented in Spring?
4. What is the IoC (Inversion of Control) Container?
5. What is the difference between BeanFactory and ApplicationContext?
6. What is a Spring Bean and what are the different scopes of a bean?
7. What is the complete Lifecycle of a Spring Bean in Spring Boot?
8. What is the difference between a standard Java Bean and a Spring Component?
9. Explain Stereotype annotations: @Component, @Service, @Repository, and
@Controller.
10.What are Custom Annotations in Spring and how can we create them?
11.What is the difference between @RestController and @Controller internally?
12.What is the difference between @Qualifier and @Primary annotations?
13.What is the difference between a @Configuration class and a normal class?
14.What is the real-world use case of CommandLineRunner?
15.What is a circular dependency in Spring, and how can we resolve it?
16.How is concurrency handled internally in a Spring Boot application?
17.What is the exact startup flow of a Spring Boot application?
18.What is the difference between @ComponentScan and @SpringBootApplication?
19.What is the role of SpringFactoriesLoader?
20.How does Spring Boot reduce XML configuration completely?
21.What are the most common Spring Boot performance mistakes developers make?
Spring Boot Internals &
Auto-Configuration
Spring Boot Internals & Auto-Configuration
1. What is Auto-Configuration in Spring Boot and how does it work internally?
2. How does Spring Boot decide which auto-configuration class to apply?
3. What happens internally when you add the spring-boot-starter-web dependency?
4. Why does Spring Boot prefer convention over configuration?
5. How does Spring Boot detect an embedded Tomcat server and configure it?
6. What happens if two beans of the same type exist and no @Qualifier is provided?
7. How does Spring Boot manage dependency versions automatically without explicit
version tags?
8. How does Spring Boot create and configure a DataSource automatically?
9. What is the difference between @EnableAutoConfiguration and @Import?
10.What happens if you explicitly exclude an auto-configuration class?
Configuration & Deployment
Configuration & Deployment
1. How does Spring Boot load the [Link] file internally?
2. How does Spring Boot handle externalized configuration?
3. What happens if both [Link] and [Link] exist in the project?
4. How can we create and manage multiple profiles/environment files in Spring Boot?
5. How does Spring Boot decide the server port priority?
6. How does Spring Boot handle logging by default?
7. What is a fat jar vs a normal jar, and how does Spring Boot deployment work?
JPA, Hibernate & Database
JPA, Hibernate & Database
1. What is ORM (Object-Relational Mapping)?
2. What is the difference between JPA and Hibernate?
3. What is the role of the EntityManager in JPA?
4. Explain the Hibernate Entity Lifecycle states.
5. What is the JpaRepository interface and how do we use it?
6. What is the difference between save() and saveAndFlush() methods in Spring Data
JPA?
7. What is the difference between Eager Loading and Lazy Loading?
8. What is the difference between load() and get() methods in Hibernate?
9. How does Spring Boot handle exception translation for database errors?
10.How do you manage DB migrations in a Spring Boot application (e.g., Flyway or
Liquibase)?
Web, REST API & Security
Web, REST API & Security
1. What is a RestAPI and what are its key constraints?
2. What is the role of the DispatcherServlet in Spring MVC?
3. What happens internally from scratch when a user hits a REST endpoint?
4. What is the difference between PUT and PATCH HTTP methods?
5. What is the difference between a Filter and an Interceptor in Spring?
6. How can we design and externalize REST APIs considering security, performance, and
scalability?
7. What is the general architectural structure of a production-ready web application?
8. How can we implement Global Exception Handling in a Spring Boot web application?
9. How can we identify slow APIs in a Spring Boot application?
10.How can we improve REST API performance?
11.What is Spring Boot Actuator and how does it integrate internally for health checks?
12.How do you implement Rate Limiting for your APIs?
13.What is Security in Java, and how can we implement OAuth2?
14.How do we add security in Spring Boot using Spring Security?
15.How does a browser check whether a website has a valid SSL certificate or not?
Microservices, Cloud & Distributed
Systems
Microservices, Cloud & Distributed Systems
1. How can we build microservices using Spring Boot and why is it preferred for cloud
native apps?
2. What is Spring Cloud and what components does it provide?
3. How does Eureka Service Discovery route requests across microservices?
4. How do you design communication between Service A, Service B, and Service C, where
only Service A should be allowed to communicate with Service B (and not Service C)?
5. How can we implement Interservice communication in microservices?
6. What is the difference between RestTemplate and WebClient?
7. How do you make an efficient outbound HTTP call in Spring Boot?
8. What is the difference between Mono and Flux in Spring WebFlux (Reactive)?
9. How is authentication and authorization managed centrally in a microservices
architecture?
10.When we create Swagger/OpenAPI documentation, how do we configure it to use a
custom authentication mechanism like JWT?
11.What is a Circuit Breaker pattern and how does it work in microservices?
12.What are the common Design Patterns used for microservice applications (e.g., Saga,
CQRS, API Gateway)?
13.How can we debug a complex microservices application in a production environment?
14.If a scheduled job (@Scheduled) is running in an application deployed across multiple
instances, how can we prevent it from executing multiple times?
15.How can we implement asynchronous programming in core Java for microservices?
16.What is Aspect-Oriented Programming (AOP) and how does it help in cross-cutting
concerns?
17.How does Redis cache work and how can we integrate/use it in Spring Boot?
18.How do we define keys and structure data in Redis for better organization?
19.How do we make Redis search results highly efficient?
20.How do we search or query multiple keys simultaneously in Redis?
21.How do we invalidate or evict cache data in Spring Boot?
22.How can we prevent duplicate message processing (Idempotency) in a message broker
like Kafka?
23.What are the steps involved in a CI/CD pipeline?
24.How can we design a system to control API latency and handle traffic-aware load
balancing?
25.A database table contains billions of records and persists about 2000 records per
second with heavy write operations. How would you design the structure, partitioning,
and indexing of this table?