Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
406 views

101 Java SpringBoot Interview Questions

Important spring boot questions

Uploaded by

roo4rohan26
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
406 views

101 Java SpringBoot Interview Questions

Important spring boot questions

Uploaded by

roo4rohan26
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

1 – 4 YOE

Java &
Spring Boot Interview
101 Frequently asked questions
in skill based rounds of Product based companies, Big-4s,
Service based companies and client interviews
Follow me : Aishwarya Suryawanshi on
Disclaimer

Dear Job Aspirants,

As I share this list of 101 frequently asked questions on Java-Spring


boot, I want to emphasize the importance of understanding the
foundational concepts thoroughly. This list serves as a reference
and a tool for revision rather than a comprehensive guide to Java
programming. It's essential to dive deep into each concept and
practice extensively to gain a comprehensive understanding.

Java and Spring boot, with its vast ecosystem and evolving
updates, requires continuous learning and exploration. While these
questions can aid in revisiting key topics and refreshing your
knowledge, they should not replace hands-on practice and in-
depth study.

Wishing you all fruitful learning experiences and success in your


Java journey!
1. Which Java version have you used in your previous project? Tell some
features.
2. Why Java is Platform Independent?
3. JVM Architecture and working. (Question around it like - What is a
ClassLoader, JVM memory model etc)
4. What is String immutability?
5. What is the difference between == and equals()?
6. How is the creation of a String using new() different from that of a literal?
7. What is a String pool? When are Strings not stored in a String pool?
8. How to create an immutable class in Java?
9. StringBuffer vs StringBuilder. When to use what?
10.What is the difference between public, protected, private, and default
access modifiers in Java?
11.How does the final keyword work in Java?
12.Abstract class vs Interfaces
13.What will happen if a class has a private constructor? Can you instantiate
this class?
14.Can you override a private or static method in Java? Explain.
15.Can you provide an example where method overloading is determined at
compile-time and method overriding at runtime?
16.Is it possible to call the base class method without creating an instance?
Provide an example.
17.Can you explain the difference between hiding and overriding in Java?
18.What is runtime polymorphism or dynamic method dispatch?
19.HashMap internal working, what is the use of equals() and hashcode()?
20.Can an ArrayList be made Thread-safe?
21.What are the differences between ArrayList and LinkedList?
22.How does a TreeMap differ from a HashMap?
23.What are some advantages of using a ConcurrentHashMap?
24.Can an ArrayList be made Thread-safe?
25.What are the differences between ArrayList and LinkedList? [Such
differences can be asked between any Collection]
26.How does a TreeMap differ from a HashMap?
27.What are some advantages of using a ConcurrentHashMap?
28.What modification you will do to make to HashMap a O(N) time complexity?
29.Comparable vs Comparator interface and when to use which one?
30.Code for producer-consumer problem
31.Can run() be overridden?
32.Synchronization in Java
33.What is the Executor framework in Java? With Example.
34.Print Odd/Even numbers in multiple threads.
35.What are the differences between synchronized and volatile keywords?
36.Use of transient keyword?
37.Explain the concept of thread safety in Java.
38.How does the ForkJoinPool work?
39.Difference between wait and sleep method.
40.Why is sleep method static?
41.Is it mandatory for a catch block to be followed after a try block?
42.What is the difference between Error and Exception in Java?
43.What is the difference between final, finally, and finalize()?
44.What is the difference between throw and throws in Java?
45.What are checked and unchecked exceptions?
46.How does the finally block work?
47.Multiple inheritance with interfaces.
48. What is the diamond problem in Java? How does Java handle it?
49. Why static and default methods in interface were introduced in Java 8?
50. Given two interfaces which have the same default method, what will
happen in the implemented class with respect to the default method?
51. What are functional interfaces?
52. Which are some of the functional interfaces in Java?
53. Consumer, Supplier, Predicate, and Function Interfaces in Java 8. Examples
of each.
54. What is the Stream API and how is it used?
55. What is the difference between Stream and ParallelStream?
56. Explain the difference between map() and flatMap() in Streams.
57. Interviewer usually asks you to write code for various scenarios using
stream’s operations like filter, map, flatMap, sorted, distinct, limit, skip,
groupingBy etc)
58. What does an Optional class do?
59. What are lambda expressions and how are they useful?
60. What is a daemon thread?
61. Which were some new features added as part of Java 17 & 21?
62. What are Records (Java 17)?
63. Which design patterns have you used in your project?
64. What is the Singleton design pattern?
65. How can you make a Singleton thread-safe?
66. SOLID Principles (IMP) with example for each principle.
67. What is Maven or Gradle, and how does it healp in Java development?
68. What is dependency Injection? Ways of dependency Injection?
69. What are beans?
70. What is Application Context in Spring?
71. Key advantages of Spring boot over Spring.
72. Default scope in Spring boot?
73. What is the role of @SpringBootApplication?
74. How does a typical architecture of Spring boot Application look like?
75. What is Spring Initializer?
76. What is @Autowired?
77. Use of @Qualifier annotation.
78. What is difference between @Component, @Controller and
@RestController?
79. Why were sealed classes introduced? What do they do?
80. Garbage Collection in Java - Internal implementation.
81. What are the different types of garbage collectors in Java?
82. Is exceeding the memory limit possible in a program despite having a
garbage collector?
83. Explain the concept of memory leak in Java.
84. How does the reflection API work in Java?
85. Design Patterns in Java.
86. Explain the use of plugins in Maven and Gradle.
87. Jar vs WAR file
88. How to add custom server instead of built-in server in Spring boot
Application?
89. How to handle exceptions in Spring boot?
90. Difference between PUT and PATCH.
91. Commonly used HTTP status codes and the uses of each.
92. @RequestParam vs @PathVariable
93. What is Spring Boot Actuator? How do you enable and configure Spring
Boot Actuator?
94. What is Spring Data JPA, and how is it used in Spring Boot?
95. How can you create RESTful services using Spring Boot? Explain the use of
@RestController, @RequestMapping, @GetMapping, @PostMapping,
@PutMapping, and @DeleteMapping.
96. How does a typical Spring boot Application look like? What annotations will
you use?
97. How do you implement security in a Spring Boot application? Explain the use
of Spring Security and its features.
98. What are the different testing techniques available in Spring Boot?
99. How do you configure logging in a Spring Boot application?
100.What are some common performance optimization techniques for Spring
Boot applications?
101. How can you implement caching in a Spring Boot application? Explain the
use of @Cacheable, @CachePut, and @CacheEvict annotations.
Please note that there are chances of the interviewer asking questions on the
advanced Spring boot topics, CI/CD, Version control, build tools, Microservice
architecture, distributed event streaming platforms used in projects and the
databases used.

SAMPLE QUESTIONS
[This is just a sample, questions will be asked based on your projects only]
• If you used Maven in projects. What is Parent POM and why we use it usually
in our projects?
• Explain the use of WebFlux, Mono, and Flux in Spring Boot applications.
• What is CI/CD?
• Different between Microservices and Monolithic Architecture. When to use
which one?
• How do you handle merge conflicts in Git?
• Explain the differences between synchronous and asynchronous
communication in microservices.
• How can you deploy and manage microservices at scale?
• How do you ensure fault tolerance and resilience in microservices?
• How do you implement load balancing in a microservices environment?
• Explain the difference between horizontal and vertical database partitioning.
• What is database sharding, and why is it used?
• What is Apache Kafka/RabbitMQ?
• How does Kafka achieve high throughput and low latency?
• What are consumer groups in Kafka, and how do they work?
• Various DB queries.
Along with this, you can also be asked to design any API (Endpoints of API,
appropriate HTTP methods -GET, POST, PUT, DELETE for CRUD operations,
Database, non-functional aspect etc).
Some Valuable Tips!

1. Know Your Projects: Be ready to discuss your past projects,


focusing on your role, technologies used, and challenges
overcome. Interviewers will definitely asked this question.

2. Understand the Job Description: Align your responses with the


skills and experiences the employer seeks.

3. Communicate Clearly with Examples if possible: Explain


technical concepts simply and clearly. Articulate your thought
process well. Give example whenever needed.

4. Be Confident: Speak clearly and assertively. Admit if you don’t


know something but show willingness to learn.

5. Research the Company: Learn about the company’s products,


culture, and recent news. Be ready to explain why you want to
work there.

All The Best!


Follow me : Aishwarya Suryawanshi on

You might also like