0% found this document useful (0 votes)
10 views3 pages

Interview Questions and Answers

The document outlines common interview questions and answers for Java developers, covering essential topics like Core Java, Spring Framework, Hibernate, REST APIs, and DevOps practices. It includes explanations of key concepts such as exceptions, garbage collection, and CI/CD pipelines. Additionally, it touches on preferred qualifications like message brokers and NoSQL databases.

Uploaded by

jatinvalechatab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Interview Questions and Answers

The document outlines common interview questions and answers for Java developers, covering essential topics like Core Java, Spring Framework, Hibernate, REST APIs, and DevOps practices. It includes explanations of key concepts such as exceptions, garbage collection, and CI/CD pipelines. Additionally, it touches on preferred qualifications like message brokers and NoSQL databases.

Uploaded by

jatinvalechatab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Interview Questions and Answers

I. Required Skills & Experience

Core Java and J2EE


 Q: What is the difference between a checked and an unchecked exception in Java?

A: Checked exceptions are validated at compile time (e.g., IOException), and must be
declared or handled. Unchecked exceptions (e.g., NullPointerException) are not checked
during compilation and usually indicate programming bugs.
 Q: How does garbage collection work in Java?

A: Java's garbage collector automatically removes unreachable objects from memory. It uses
algorithms like generational GC, which divides the heap into Young and Old generations for
efficiency.

Spring Framework (Boot, MVC, Security)


 Q: What is the role of Spring Boot starters?

A: Starters are pre-configured dependencies that simplify project setup. For example,
spring-boot-starter-web bundles dependencies for web applications.
 Q: How do you secure a REST API using Spring Security?

A: You configure HttpSecurity in a WebSecurityConfigurerAdapter to define access rules.


For authentication, you can use JWT tokens or OAuth2 providers.

Hibernate/JPA and Databases


 Q: What is the difference between Hibernate and JPA?

A: JPA is a specification, while Hibernate is an implementation. You use JPA annotations like
@Entity, and Hibernate provides additional features like caching and more complex query
support.
 Q: What is the N+1 select problem?

A: It occurs when the application fetches an entity and then lazily fetches its related entities
in a loop, causing many SQL queries. It can be resolved using JOIN FETCH or batch fetching.

REST, SOAP, and Microservices


 Q: How do you version a REST API?

A: By adding the version in the URL (/api/v1/resource), header versioning, or using media
types (Accept: application/vnd.app.v1+json).
 Q: What is a Circuit Breaker pattern?
A: It prevents cascading failures by stopping calls to a failing service for a time. Netflix
Hystrix or Resilience4j can implement it.

Build Tools & Version Control


 Q: What’s the difference between Maven and Gradle?

A: Maven uses XML for configuration and is declarative, while Gradle uses Groovy/Kotlin
and is more flexible and faster with incremental builds.
 Q: How do you resolve Git merge conflicts?

A: By using git status to identify conflicts, editing the conflicting files, then staging (git add)
and committing the resolved state.

Cloud Platforms and Containers


 Q: What is a Dockerfile?

A: A text file with instructions to build a Docker image, like:


FROM openjdk:17
COPY . /app
WORKDIR /app
RUN ./mvnw install
CMD ["java", "-jar", "target/app.jar"]
 Q: How do Kubernetes and Docker work together?

A: Docker creates and runs containers; Kubernetes orchestrates and manages those
containers at scale with services like auto-scaling and load balancing.

Agile/Scrum & Teamwork


 Q: How do you manage work in a Sprint?

A: We use Jira for task tracking, participate in daily standups, plan work in Sprint Planning,
and review deliverables in Sprint Review.
 Q: Describe a teamwork challenge and how you handled it.

A: In a previous project, a backend and frontend team were misaligned. I proposed a shared
Swagger doc to ensure API clarity, which improved communication and delivery speed.

II. Preferred Qualifications

Message Brokers (Kafka, RabbitMQ)


 Q: How does Kafka differ from RabbitMQ?

A: Kafka is distributed and ideal for high-throughput event streaming. RabbitMQ supports
complex routing and message queues. Kafka is log-based; RabbitMQ is queue-based.
 Q: How do you ensure message delivery in Kafka?
A: By setting acks=all, enabling retries, and using idempotent producers or consumer offset
management.

NoSQL Databases (MongoDB, Cassandra)


 Q: When would you use MongoDB over a relational DB?

A: When you need flexible schemas, horizontal scaling, and store semi-structured or
unstructured data like documents or logs.
 Q: What is eventual consistency in Cassandra?

A: Writes are distributed; reads may return stale data temporarily. Tuned using consistency
levels like QUORUM or ONE.

Front-End Knowledge
 Q: How do you support front-end teams as a backend developer?

A: By creating well-documented APIs, handling CORS, ensuring fast response times, and
using tools like Swagger or Postman for testing.

DevOps Practices
 Q: What does a typical CI/CD pipeline look like for you?

A: Code pushed to Git triggers a Jenkins job, builds via Maven, runs tests, and deploys to
staging using Docker. Ansible may provision infrastructure if needed.

You might also like