0% found this document useful (0 votes)
33 views6 pages

Java Developer Pre-Screening Guide

The document outlines a 1-hour pre-screening interview for Java developers, covering key topics such as Core Java, Java Collections, Multi-Threading, Spring Boot, Database, and DevOps. Each section includes specific questions along with ideal answers that highlight essential concepts and differences in Java programming. The interview aims to assess candidates' understanding of Java fundamentals, frameworks, and best practices.

Uploaded by

mbsyed11
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)
33 views6 pages

Java Developer Pre-Screening Guide

The document outlines a 1-hour pre-screening interview for Java developers, covering key topics such as Core Java, Java Collections, Multi-Threading, Spring Boot, Database, and DevOps. Each section includes specific questions along with ideal answers that highlight essential concepts and differences in Java programming. The interview aims to assess candidates' understanding of Java fundamentals, frameworks, and best practices.

Uploaded by

mbsyed11
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

Java Developer – 1-Hour Pre-Screening

Interview (Questions + Ideal Answers)

SECTION 1 — Core Java (20 minutes)


1. Difference between JDK, JRE, and JVM.

Good Answer:

 JDK: Development kit → has compiler (javac), tools.


 JRE: Runtime environment → libraries + JVM.
 JVM: Executes bytecode, platform-independent engine.

2. Explain OOP concepts with examples.

Good Answer:

 Encapsulation (hiding data in classes, getters/setters).


 Inheritance (child class extending parent).
 Polymorphism (method overriding / overloading).
 Abstraction (abstract classes/interfaces).

3. What is the difference between HashMap and ConcurrentHashMap?

Good Answer:

 HashMap is not thread-safe, allows one null key, multiple null values.
 ConcurrentHashMap is thread-safe, uses segmented lock/concurrency, does not allow
nulls.

4. What is the difference between final, finally, and finalize()?

Good Answer:

 final keyword → constant or cannot override/extend.


 finally block → executes after try/catch.
 finalize() → cleanup before GC (deprecated).

5. Explain Checked vs Unchecked Exceptions.

Good Answer:

 Checked: Checked at compile time (IOException, SQLException).


 Unchecked: Runtime exceptions (NullPointerException, ArithmeticException).

6. How does garbage collection work in Java?

Good Answer:
JVM automatically frees unused objects using generational GC (Young, Old Gen), uses
algorithms such as Mark-and-Sweep, G1 GC, ZGC.

SECTION 2 — Java Collections & Functional Programming


(10 minutes)
7. What is the difference between List, Set, and Map?

Good Answer:

 List: Indexed, duplicates allowed.


 Set: No duplicates, no index.
 Map: Key-value pair.

8. Explain Stream API and its benefits.

Good Answer:

 Used for processing collections declaratively.


 Supports operations like filter, map, reduce.
 Enables parallel execution and clean code.
9. What is immutability? How to create immutable objects?

Good Answer:

 Once created, state cannot change.


 Make class final, private fields, no setters, constructors initialize everything.

SECTION 3 — Multi-Threading & Concurrency (10


minutes)
10. Difference between synchronized method and synchronized block.

Good Answer:

 Method: Locks entire method.


 Block: Locks only the code you specify → better performance.

11. What is a Deadlock? How do you avoid it?

Good Answer:
Deadlock = threads waiting forever for each other’s locks.
Avoid using proper locking order, timeout locks, using Concurrent utilities.

12. Explain ExecutorService.

Good Answer:
Manages thread pools, allows asynchronous tasks (submit(), [Link]()), better than
manual thread creation.

SECTION 4 — Spring Boot & Microservices (15 minutes)


13. What are the main Spring Boot features?

Good Answer:

 Auto-configuration
 Embedded servers
 Starter dependencies
 Actuator
 Simpler microservice development

14. Difference between @Component, @Service, and @Repository.

Good Answer:
All are stereotype annotations.

 @Component: Generic bean.


 @Service: Business logic layer.
 @Repository: DAO layer + exception translation.

15. How does Dependency Injection work in Spring?

Good Answer:
Spring container creates objects (beans) and injects them using constructor, setter, or field
injection.

16. Explain REST principles.

Good Answer:

 Stateless
 Client-server separation
 Cacheable
 Uniform resource interface
 Layered system

17. How do you handle exceptions in Spring Boot?

Good Answer:

 Use @ControllerAdvice + @ExceptionHandler.


 Custom error response models.
 Global exception handlers.
18. What is Feign Client or RestTemplate used for?

Good Answer:
Used for calling external microservices.
Feign = declarative; RestTemplate = classic HTTP.

SECTION 5 — Database & JPA/Hibernate (5 minutes)


19. What is the difference between lazy and eager loading?

Good Answer:

 Lazy: Loads only when needed (default for collections).


 Eager: Loads immediately → can hurt performance.

20. How does JPA/Hibernate caching work?

Good Answer:

 Level 1 cache: Per session.


 Level 2 cache: Shared across sessions (Ehcache, Redis).
Reduces DB hits.

SECTION 6 — DevOps & Tools (5 minutes)


21. What is CI/CD?

Good Answer:
Continuous Integration (automated builds/tests) + Continuous Delivery/Deployment (auto
release).

22. How do you build and package a Spring Boot project?

Good Answer:
Using Maven/Gradle → creates .jar or .war (using mvn clean install).
23. What is Docker, and why use it for Java apps?

Good Answer:
Runs apps in isolated containers; ensures portability, consistent runtime environment.

You might also like