This is a very good Deloitte Java Full Stack Developer L1 interview list. Below are interviewer-level answers in a structured format. These are suitable for 3 years of Java Spring Boot experience and are detailed enough to handle follow-up questions.
1) Tell me about yourself
Answer
"Hello, my name is Bhupendra Kumar. I have around 3 years of experience as a Java Full Stack Developer.
I primarily work on developing enterprise applications using Java 17, Spring Boot, Spring MVC, Spring Data JPA, Hibernate, Spring Security, REST APIs, Microservices, Kafka, Redis, MySQL/PostgreSQL, Angular 14, and AWS services like EC2, S3, and RDS.
In my recent project, which is a Hotel Management System built on Microservices architecture, I worked on:
- Developing REST APIs using Spring Boot
- Designing and implementing Microservices
- Kafka-based asynchronous communication
- JWT Authentication and Authorization
- Redis caching for performance improvement
- MySQL/PostgreSQL database design
- AWS S3 integration for image uploads
- Docker containerization
- Git and Maven for version/build management
I also actively participated in bug fixing, production issue analysis, API optimization, code reviews, and Agile Scrum ceremonies.
Now I'm looking for an opportunity where I can contribute to scalable enterprise applications while continuously improving my technical skills."
Follow-up Questions
What is your daily work?
"My day usually starts with the Scrum stand-up meeting.
After that I:
- Pick Jira stories
- Develop new REST APIs
- Fix production bugs
- Review pull requests
- Write SQL queries
- Test APIs using Postman
- Coordinate with frontend developers
- Participate in code reviews
- Deploy builds on testing environments
- Attend sprint planning and retrospective meetings."
2) If API is slow how do you debug it?
Step-by-step approach
Whenever an API is slow, I never assume the problem.
I follow a systematic approach.
Step 1
Check API response time
Example
Postman
or
Browser Developer Tools
or
APM Tools
Step 2
Check Application Logs
INFO
WARN
ERROR
Look for
- Exceptions
- Timeout
- Retry
- Long processing
Step 3
Check Database Query
Most slow APIs are caused by SQL.
Check
- Slow Query
- Missing Index
- Full Table Scan
- Joins
- N+1 Query Problem
Example
EXPLAIN SELECT ...
Step 4
Check External APIs
Maybe
Payment API
Email API
OTP API
SMS API
are slow.
Step 5
Thread Dump
Maybe all threads are blocked.
jstack
Step 6
CPU & Memory
Check
top
htop
jconsole
VisualVM
Step 7
Network Latency
Maybe
API Gateway
Load Balancer
Firewall
is causing delay.
Step 8
Profiling
Use
Spring Boot Actuator
Prometheus
Grafana
New Relic
Dynatrace
Finally optimize
- Redis Cache
- Database Index
- Async Processing
- Pagination
- Connection Pool
- Batch Queries
3) Explain how to optimize slow running SQL Queries
Answer
There are multiple ways.
1. Create Indexes
Without index
Full Table Scan
With Index
Index Scan
Huge improvement.
2. Use EXPLAIN PLAN
EXPLAIN
SELECT * FROM employee;
Check
- Table Scan
- Index Usage
- Cost
3. Avoid SELECT *
Instead
SELECT id,name
4. Avoid unnecessary joins
Only join required tables.
5. Use Pagination
Instead of
SELECT *
Use
LIMIT
OFFSET
6. Optimize WHERE clause
Bad
WHERE UPPER(name)
Good
WHERE name='John'
7. Batch Insert
Instead of
1000 Inserts
Use
Batch Insert
8. Remove Duplicate Queries
Avoid
N+1 Query Problem
9. Normalize or Denormalize carefully
Depends on use case.
10. Cache frequently used data
Using Redis.
4) How Microservices communicate?
There are two ways.
1. Synchronous Communication
Request waits for response.
Examples
- REST API
- Feign Client
- WebClient
- gRPC
Flow
Order Service
↓
User Service
↓
Response
Advantages
Simple
Easy debugging
Disadvantages
Tightly dependent
Slow if downstream fails
2. Asynchronous Communication
Uses Message Broker.
Examples
- Kafka
- RabbitMQ
- ActiveMQ
Flow
Booking Service
↓
Kafka Topic
↓
Notification Service
↓
Email Service
Advantages
High throughput
Loose coupling
Scalable
Reliable
5) LEFT JOIN vs RIGHT JOIN
Assume
Employee
1 Rahul
2 Amit
3 Neha
Department
1 HR
2 IT
LEFT JOIN
Employee LEFT JOIN Department
Returns
Rahul HR
Amit IT
Neha NULL
All rows from LEFT table.
RIGHT JOIN
Employee RIGHT JOIN Department
Returns
All rows from RIGHT table.
If no matching record exists in RIGHT table during a LEFT JOIN:
Right table columns become NULL.
If no matching record exists in LEFT table during a RIGHT JOIN:
Left table columns become NULL.
6) Optional class
Purpose
Avoid
NullPointerException
Example
Without Optional
String name = employee.getName();
System.out.println(name.length());
Null → Exception
With Optional
Optional<String> name =
Optional.ofNullable(employee.getName());
Methods
of()
Non-null value only
ofNullable()
Allows null
empty()
Creates empty Optional
isPresent()
Checks value exists
ifPresent()
Executes if present
name.ifPresent(System.out::println);
orElse()
Returns default value
name.orElse("Unknown");
orElseGet()
Lazy evaluation
orElseThrow()
Throws exception
map()
Transforms value
filter()
Filters Optional
7) transient vs volatile
| transient | volatile |
|---|---|
| Used in Serialization | Used in Multithreading |
| Field not serialized | Ensures latest value is visible across threads |
| JVM ignores during serialization | Prevents thread-local caching |
| Object state | Thread visibility |
Example
transient String password;
Password won't be serialized.
volatile boolean running=true;
All threads immediately see updates.
Follow-up: volatile ensures visibility, but it does not make compound operations (like count++) atomic.
8) Java Streams - Sort Employees
employees.stream()
.sorted(
Comparator.comparing(Employee::getAge)
.thenComparing(Employee::getSalary)
)
.forEach(System.out::println);
Descending salary
employees.stream()
.sorted(
Comparator.comparing(Employee::getSalary)
.reversed()
)
.forEach(System.out::println);
Time Complexity
O(n log n)
9) CompletableFuture
Purpose
Execute tasks asynchronously without blocking the main thread.
Example
Suppose an API needs:
- User Details
- Orders
- Payments
Sequential
2 + 3 + 2 = 7 sec
Parallel
max(2,3,2)=3 sec
Code
CompletableFuture<User> user =
CompletableFuture.supplyAsync(() -> getUser());
CompletableFuture<List<Order>> orders =
CompletableFuture.supplyAsync(() -> getOrders());
CompletableFuture<Payment> payment =
CompletableFuture.supplyAsync(() -> getPayment());
CompletableFuture.allOf(user, orders, payment).join();
Response response = new Response(
user.join(),
orders.join(),
payment.join());
Useful methods:
supplyAsync()runAsync()thenApply()thenCompose()thenCombine()exceptionally()allOf()anyOf()join()
10) Internal Working of HashMap
Step 1
HashMap computes hash
hash(key)
Step 2
Find bucket
index = hash % capacity
Step 3
Store Entry
Key
Value
Hash
Next Node
Collision
Two keys
101
201
may map to same bucket.
Earlier (before Java 8)
Linked List
After Java 8
If bucket size > 8 and capacity ≥ 64
Red Black Tree
Otherwise
Linked List
Same key inserted again?
map.put("A",100);
map.put("A",200);
Old value
100
is replaced with
200
HashMap uses equals() and hashCode() to determine if the key already exists.
11) How do you handle exceptions in Spring Boot?
I use centralized exception handling to keep APIs consistent.
1. Service Layer
Throw meaningful custom exceptions.
throw new ResourceNotFoundException("User not found");
2. Global Exception Handler
Use @RestControllerAdvice and @ExceptionHandler.
@RestControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(ResourceNotFoundException.class)
public ResponseEntity<String> handle(ResourceNotFoundException ex) {
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(ex.getMessage());
}
}
3. Validation Errors
Use @Valid with MethodArgumentNotValidException.
4. Standard Error Response
Return a consistent JSON like:
{
"timestamp": "2026-08-02T16:00:00Z",
"status": 404,
"error": "Not Found",
"message": "User not found",
"path": "/users/1"
}
Benefits:
- Cleaner controller code
- Consistent API responses
- Easier debugging
- Better client experience
12) What is Drools? How do you integrate it with Spring Boot?
What is Drools?
Drools is a Business Rule Management System (BRMS). It allows business rules to be written separately from Java code, so rules can change without modifying the application's core logic.
Example use cases:
- Insurance premium calculation
- Loan eligibility
- Discount calculation
- Fraud detection
- Order validation
Key Components
- Facts: Java objects passed into the rule engine.
-
Rules: Written in
.drlfiles. - Knowledge Base (KieBase): Stores compiled rules.
- Session (KieSession): Executes the rules.
Example Rule
rule "Senior Citizen Discount"
when
$customer : Customer(age >= 60)
then
$customer.setDiscount(20);
end
Spring Boot Integration Steps
- Add Drools dependencies (
kie-api,drools-core,drools-compiler). - Place
.drlfiles undersrc/main/resources. - Configure a
KieContainerandKieSessionbean. - Inject
KieSessioninto your service. - Insert facts and fire rules.
Example:
kieSession.insert(customer);
kieSession.fireAllRules();
Advantages
- Business rules are separated from application code.
- Rules can be updated with minimal code changes.
- Easy for business analysts to manage rule logic.
- Suitable for complex decision-making systems.
Deloitte Interview Tips
- Answer using the STAR (Situation–Task–Action–Result) approach for experience-based questions.
- Explain concepts first, then provide a simple example.
- Mention practical tools you've used (Postman, Redis, Kafka, Spring Boot Actuator, MySQL, AWS, Docker).
- If you don't know a topic deeply (like Drools), be honest about your exposure and explain the fundamentals correctly.
- Expect follow-up questions after each answer, especially on
HashMap,CompletableFuture, SQL optimization, and exception handling, as these are common areas for deeper discussion.
These answers are suitable for an experienced Java Full Stack Developer interview and provide a strong foundation for handling follow-up questions.
============================================
This is an excellent list for a Deloitte Java Full Stack (3+ Years Experience) interview. Deloitte interviewers usually expect:
- Definition
- Why it is used
- Real-time example
- Interview follow-up questions
Below are structured answers.
ROUND 1
1. Difference between Abstraction and Interface
Abstraction
Abstraction means hiding the implementation details and showing only the necessary functionality to the user.
It focuses on what an object does, not how it does it.
It is achieved using:
- Abstract class
- Interface
Example:
abstract class Vehicle{
abstract void start();
void stop(){
System.out.println("Vehicle stopped");
}
}
An abstract class can have:
- Abstract methods
- Concrete methods
- Constructors
- Instance variables
Interface
An interface defines a contract that implementing classes must follow.
Example
interface Payment{
void pay();
}
class CreditCard implements Payment{
public void pay(){
System.out.println("Payment done");
}
}
Differences
| Abstract Class | Interface |
|---|---|
| Can have constructors | No constructors |
| Can have instance variables | Only constants |
| Can have abstract & concrete methods | Java 8+: default, static & private methods |
| Single inheritance | Multiple inheritance |
| Used when classes share common behavior | Used for capability/contract |
Real Example
Vehicle hierarchy
Vehicle
↓
Car
↓
Bike
Abstract class is better because all vehicles have common properties.
Payment Gateway
Payment
↓
UPI
Credit Card
PayPal
Interface is better because all payment methods implement the same contract.
Follow-up
Why does Java support multiple inheritance through interfaces but not classes?
Because multiple class inheritance creates the Diamond Problem, causing ambiguity. Interfaces avoid this because they primarily define contracts, and Java resolves conflicts if default methods clash.
2. equals() and hashCode() Contract
Both methods come from Object class.
equals()
Used to compare object contents.
emp1.equals(emp2)
Returns
true
false
hashCode()
Returns an integer hash value used by HashMap and HashSet.
Contract
If
a.equals(b)
is
true
Then
a.hashCode()==b.hashCode()
must also be true.
The reverse is not required: two different objects may have the same hash code (collision).
Why?
HashMap first compares hashCode() to find the bucket, then uses equals() to confirm key equality.
Real Example
Employee ID
101
Two employee objects with ID 101 should be equal.
Follow-up
What happens if hashCode() is overridden but equals() isn't?
HashMap/HashSet may behave incorrectly because logically equal objects won't be recognized as equal.
3. Why String is Immutable
String cannot be modified after creation.
String s="Java";
s.concat("17");
Output
Java
A new String object is created; s still refers to the original object.
Why?
Security
Passwords
Database URLs
File Paths
cannot be modified accidentally.
Thread Safe
Multiple threads can safely share Strings.
String Pool
Reduces memory usage.
String a="Java";
String b="Java";
Both refer to the same pooled object.
HashMap Key
Since String never changes, its hashCode remains stable.
Follow-up
Can immutable objects be modified?
No. Any apparent modification creates a new object.
4. Java 7 Interface vs Java 8 Interface
Java 7
Only
public abstract
methods.
interface A{
void display();
}
Java 8
Introduced
- Default methods
- Static methods
default void test(){}
static void show(){}
Java 9 additionally introduced private methods in interfaces.
Why?
To add new methods to interfaces without breaking existing implementations.
Example
List.sort()
is implemented using default methods.
5. Checked vs Unchecked Exception
Checked
Checked at compile time.
Example
IOException
SQLException
Must be handled using
try-catch
throws
Unchecked
Occurs during runtime.
Example
NullPointerException
ArithmeticException
ArrayIndexOutOfBoundsException
Handling is optional.
Differences
| Checked | Unchecked |
|---|---|
| Compile Time | Runtime |
| Must Handle | Optional |
| Extends Exception | Extends RuntimeException |
throw vs throws
throw
Used to explicitly throw an exception.
throw new RuntimeException();
throws
Declares that a method may throw an exception.
public void save() throws IOException
6. Comparable vs Comparator
Comparable
Natural ordering.
compareTo()
Inside class.
Comparator
Custom sorting.
compare()
Outside class.
Example
Sort by Age
Comparator.comparing(Employee::getAge)
Sort by Salary
Comparator.comparing(Employee::getSalary)
7. Sort Employee List
Age
employees.stream()
.sorted(Comparator.comparing(Employee::getAge))
.toList();
Salary Desc
employees.stream()
.sorted(Comparator.comparing(Employee::getSalary).reversed())
.toList();
Filter Salary > 50000
employees.stream()
.filter(e->e.getSalary()>50000)
.toList();
8. @SpringBootApplication
It is a combination of three annotations:
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan
Responsibilities
- Configuration class
- Auto-configures Spring Boot
- Scans beans in the current package and subpackages
9. How Microservices Communicate
Synchronous
REST API
Feign Client
WebClient
gRPC
Client waits for response.
Asynchronous
Kafka
RabbitMQ
ActiveMQ
Producer sends event → Consumer processes later.
Real Example
Booking Service
↓
Kafka
↓
Notification Service
↓
ROUND 2
10. Process vs Thread
| Process | Thread |
|---|---|
| Independent program | Smallest execution unit |
| Own memory | Shared memory within process |
| Heavyweight | Lightweight |
| Slow creation | Fast creation |
11. Multitasking vs Multithreading
Multitasking
Multiple applications running.
Example
Chrome
VS Code
Spotify
Multithreading
Multiple threads inside one application.
Example
Download
UI
Logging
12. Runnable vs Callable
Runnable
run()
No return value.
Cannot throw checked exceptions.
Callable
call()
Returns result.
Can throw checked exceptions.
Used with Future/CompletableFuture.
13. How Concurrency is Achieved
- Multiple threads
- ExecutorService
- Thread Pool
- CompletableFuture
- Synchronization
- Locks
- Virtual Threads (Java 21)
14. volatile Keyword
Ensures visibility of changes across threads.
volatile boolean running=true;
One thread updates the value, other threads immediately see the updated value.
Important: volatile does not make compound operations (count++) atomic.
15. Producer Consumer Problem
Producer creates data.
Consumer processes data.
Shared queue.
Java solution
BlockingQueue
Kafka
RabbitMQ
16. Thread Pool Executor
Instead of creating new threads every time,
Reuse existing threads.
Benefits
- Better performance
- Less memory
- Controlled thread creation
17. Bean Definition
Bean is an object managed by Spring IoC Container.
Created using
@Component
@Service
@Repository
@Bean
18. Stereotype Annotations
| Annotation | Purpose |
|---|---|
| @Component | Generic Bean |
| @Service | Business Logic |
| @Repository | Database Layer |
| @Controller | MVC Controller |
| @RestController | REST APIs |
19. @primary vs @Qualifier
If multiple beans of the same type exist:
@primary
Default bean.
@Qualifier
Select a specific bean by name.
@Autowired
@Qualifier("upiPayment")
private Payment payment;
20. Prototype Bean inside Singleton
Injecting a prototype bean directly into a singleton creates it only once.
Solutions:
ObjectProviderProviderApplicationContext- Method injection (
@Lookup)
21. N+1 Problem
Occurs when one query loads parent records and additional queries load each child's data individually.
Example:
1 query → Employees
100 queries → Departments
Total = 101 queries.
Solutions:
- Fetch Join
- EntityGraph
- Batch Fetching
22. SQL vs NoSQL
| SQL | NoSQL |
|---|---|
| Structured | Flexible |
| Fixed Schema | Dynamic Schema |
| ACID | BASE (often) |
| MySQL/PostgreSQL | MongoDB/Cassandra |
23. Kafka
Partition
Allows parallel processing.
Offset
Unique position of a message inside a partition.
Consumer stores offsets to resume processing.
ROUND 3
24. SOLID Principles
S — Single Responsibility Principle
One class should have only one reason to change.
O — Open/Closed Principle
Open for extension, closed for modification.
L — Liskov Substitution Principle
Child class should be replaceable for parent class without breaking behavior.
I — Interface Segregation Principle
Clients should not depend on methods they don't use.
D — Dependency Inversion Principle
Depend on abstractions (interfaces), not concrete implementations.
25. DRY Principle
Don't Repeat Yourself.
Avoid duplicate code by extracting common logic into reusable methods, classes, or utilities.
26. Circuit Breaker, Retry & Fallback
Circuit Breaker
Stops repeated calls to a failing service after a threshold, preventing cascading failures.
Retry
Automatically retries transient failures (e.g., temporary network issues) a limited number of times.
Fallback
Provides an alternate response when the primary service is unavailable.
Real-world example:
If the Payment Service is temporarily down:
- Retry 3 times.
- If it still fails, the Circuit Breaker opens and stops further calls.
- Return a fallback response such as: "Payment service is currently unavailable. Please try again later."
In Spring Boot, these patterns are commonly implemented using Resilience4j.
27. AWS EC2, SNS & SQS
EC2 (Elastic Compute Cloud)
- Virtual machine in AWS.
- Used to host Spring Boot applications.
- Supports Auto Scaling and Load Balancers.
SNS (Simple Notification Service)
- Pub/Sub messaging service.
- One message can be delivered to multiple subscribers (email, SMS, SQS, Lambda, HTTP).
SQS (Simple Queue Service)
- Message queue for asynchronous communication.
- Producers send messages; consumers process them independently.
- Helps decouple microservices and improves reliability.
Common interview follow-up:
When to use SNS vs SQS?
- SNS: One-to-many message distribution (fan-out).
- SQS: Reliable one-to-one message queuing with durable processing.
Deloitte Interview Tips
When answering technical questions:
- Start with a clear definition.
- Explain why it is used.
- Give a real-world project example.
- Mention advantages and limitations.
- Be ready for follow-up questions.
Top comments (0)