0% found this document useful (0 votes)
8 views2 pages

Java Backend Interview Guide

The document is a Java Backend Interview Guide that covers key topics such as Core Java, Spring Boot, Microservices, Performance Tuning, and CI/CD with questions and solutions. It includes a take-home coding assignment to build a Spring Boot microservice for managing SIM activation with specific requirements. The guide provides concise explanations and examples for each topic to aid in interview preparation.

Uploaded by

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

Java Backend Interview Guide

The document is a Java Backend Interview Guide that covers key topics such as Core Java, Spring Boot, Microservices, Performance Tuning, and CI/CD with questions and solutions. It includes a take-home coding assignment to build a Spring Boot microservice for managing SIM activation with specific requirements. The guide provides concise explanations and examples for each topic to aid in interview preparation.

Uploaded by

yag9898
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java Backend Interview Guide – With Solutions & Take■Home Assignment

1. Core Java & Multithreading – Questions & Solutions

Q1. Difference between synchronized and ReentrantLock?


Synchronized is simpler but blocks entirely; ReentrantLock offers timeout, fairness, interruptible
lock waits.

Q2. What is volatile?


Volatile guarantees visibility of changes across threads but does not ensure atomicity.

Q3. How does ThreadPoolExecutor work?


It manages worker threads, task queue, and rejection policies. Improves throughput by reusing
threads.

2. Spring Boot & REST APIs – Questions & Solutions

Q1. What is Spring Boot auto■configuration?


Spring Boot scans classpath and configures beans automatically unless explicitly overridden.

Q2. How do you design idempotent REST endpoints?


Use same input → same result; e.g., PUT, PATCH or unique request IDs.

Q3. How does @RestController differ from @Controller?


@RestController returns JSON directly; @Controller returns views.

3. Microservices Architecture – Questions & Solutions

Q1. How do services communicate?


Sync via REST; async via queues (Kafka/RabbitMQ). Async reduces coupling.

Q2. What is API gateway?


A single entry point for routing, auth, rate■limiting, and aggregations.

4. Performance Tuning & JVM Optimization – Solutions

Q1. How to diagnose high CPU?


Use top, jstack, async■profiler, identify loops or locks.

Q2. Common JVM flags?


-Xms, -Xmx, G1GC settings for controlled memory and stable GC.

5. CI/CD & Cloud

Q1. What is CI/CD?


Automated build, test, deploy pipeline using GitHub Actions/Jenkins.
Q2. What are readiness & liveness probes?
Readiness: can receive traffic; Liveness: app health for restarts.

Take■Home Coding Assignment

Assignment:
Build a Spring Boot microservice to manage SIM activation. Requirements: 1. Endpoints: POST
/activate, GET /status/{id} 2. Store data in an in■memory DB (H2) 3. Include validation, logging,
and global exception handler 4. Expose Prometheus metrics 5. Write at least 3 unit tests

You might also like