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

Java Springboot Question

1. The document contains questions related to microservices architecture, REST APIs, and technologies like Spring and Spring Boot. It asks about the candidate's experience developing and migrating applications to microservices. 2. It also contains questions about Java concepts like streams, lambda expressions, collections, and design patterns. 3. Finally, it asks questions about monitoring, security, performance, and scaling of microservices applications.

Uploaded by

test.test
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
560 views

Java Springboot Question

1. The document contains questions related to microservices architecture, REST APIs, and technologies like Spring and Spring Boot. It asks about the candidate's experience developing and migrating applications to microservices. 2. It also contains questions about Java concepts like streams, lambda expressions, collections, and design patterns. 3. Finally, it asks questions about monitoring, security, performance, and scaling of microservices applications.

Uploaded by

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

General questions and specific to REST API / Microservices

----------------------------------------------------------
Role played
Projects worked
Explain the project worked - details
How many microservices were there in the project
Was it monolithic to Microservices or new Microservices development?
Details on experience on Monolithic to Microservices migration?
Experience on developing REST API using Java Spring boot.

Explain your last project and its Architecture.

Basics of Spring and Springboot (e.g. scope of bean, controller classes, service
classes etc)
Java 1.8 – hands-on experience. Knowledge on stream API
If you have 1000 of requests for a single API, what will happen in background?
What is bean scope? What is Singleton ? whats is Circuit breaker pattern.
REST controller is a Sprig bean or not ?
What is the default scope of Spring bean?
What is Lazy loading?
If we have created some bean - written it as lazy loading and I need to use those
beans in my JUNIT. What do I do to initializing the beans?
What annotations you would put ? If my api is calling another API, what I do in
JUNIT to mock it? What expressions you have used ?
What is lambda expression? Why we need anonymous method? Give a use case?
What is a stream?
What is entry set?
Understand how public, private, static methods are used and how they can be called
from each other.
can you call a private method from publec and vice versa?
If you call a static private method from a public method what will happen?
Security on API?
How the token in header would be verified ?
How the header value will be authenticated ?
Difference between an abstract class and an interface?
What is a list and what needs to be done to add objects to a list?
Can you add objects of different types to a a list at the same time?
Were you able to control coding/ development standards? How it was managed/
maintained?
If there is a common functionality across services ...how did you handled it?
What are the artifacts needed for developing a REST API Microservice?
Any exp on JSON/ Yaml/ RAML? How do you create yaml from json or RAML from YAML or
pojo from Json?
What approach you chose when migrated to Microservices and how did you decide there
will be 30-40 microservices?
how did you come up with a solution to connect a downstream system which was
connected by all the services?
How do you manage inter service communication?
For MQ , were the calls Synchronous or Asynchronous
For http based connectivity, what is the way to handle Asynchronous services in
Springboot?
Are there multiple instances for services or just one ?
Any API gateway used?
What kind of coding standards did you set to ensure that standards are followed?
If you received 1000s of request, what would you to ensure that there is no multi-
threading issue occurs
Do you think Synchronization will slow down the throughput?
Anything on throttling ?
For thousand or millin requests how many instances of REST instances will be
created?
How do you handle scaling of the Application @Coding level and @InfraLevel

Difference between SOAP and REST API?


What is a Hashmap?
What is the use of equals method?
How partitioning wokrs in Kafka?

New Features of Java 8

What is the default scope of bean


What if the scope is component ?

What is grafana?
What is Prometheus?
Can Prometheus time series data ?

in Java 8, have you worked in streams?

Write a code using streams in Java 8


A list of employees E1, E2, E10
Employee has name and age who age is > 35

list.stream().filter((e)->e.getAge()>35).forEach(syso(e.getNmae()));

What is a filer?
What is a predicate?

Can I have 2 or more predicates within a filter method?

list.stream().filter(e->e.getAge()>35 &&
e.getAge()<45)..forEach(syso(e.getNmae()));

What is a stream. Advantags/ disadvantages


Can it hold data?
what are structures?
Does a stream need a data structure?

write code for


nxn

123
456
789

I have random numbers between 1 to 100 and I want to find the occurrence of these
numbers

Which Java collection you will use


What is the default size of the map and what is the load factor

What is the downsize of using the map

If I write my own integer class Java and I put it under Java.lang which one would
be loaded first?

What is class loader hierarchy?

What is the highest traffic that was through the Microservices?

How would you take care of the perfoamnce aspect of the microservice?

How you can override the number of thereads for a microservice?

whatis the annotation for race controller class.

What is callback method?

have you used ny middleware technologies to handle responses?

Have you used any API gateway?

Any monitoring tols used ?

Any exposure to splunk, datadog, ELK, EFK, Appdynamics etc

1.Print numbers from the string "ab45d78" using stream API


2.How to call external URL
3.If API fail to respond there should 3 retries.
4.if API calls from A -> B then 3 retries should happen,
if API calls from C -> B then no retries should happen.
5.Difference between Hashmap and Hashtable.
6. what If I place hashmap in synchronize block , then no difference hashmap and
hashtable.

Java
1) Different ways to sum list of integers using Streams
2) How to identify and handle null pointer exception in java 8. (My answer was
using Optional class)
3) Explain immutable class and write a sample code. Similarly, Example code for
singleton
(Bala added a scenario like what happens if there is a date object in our custom
immutable class, how to copy the value of date object to our custom immutable
class)
4) Features of Java 8
5) Explain try with resources.
6) What is reduce function in Java Streams. Give an example.
7) What are parallel streams? What are its advantages and disadvantages.
8) Explain where you have used method override concept? Can we change the access
modifiers when overriding a method. (Example From Default to public or Public to
private etc)
9) String comparison (with == and equals() method and using new keyword)
10) What is peek () function in Java 8 streams?
11) Can a Optional hold null values? ( Answer is yes, only if create by using
optional.ofNullble() method but the resulting value will be empty optional object)

Spring/Spring Boot
1) What is actuator and why it is used?
2) How exceptions will be handled in Spring boot applications (He is expecting
about global exception handling using @ControllerAdvice)
3) Explain some Design Patterns of Micro service architecture.
4) Explain the communication between microservices (Sync and Async
Communication)
5) Write a sample code to demonstrate a Rest API GET end point.
6) Were do you store your DB credential in your application.
7) How you’ll read the properties values in your application. (How to read
values from application. Properties file from our Java code. Here we can use @Value
annotation approach and we have another class in spring to read values from
properties file. We can explain both)
Example :
/** The reporting service url. */
private static String reportingServiceUrl;

/**
* Sets the reporting service url.
*
* @param reportUrl the new reporting service url
*/
@Value("${reporting-service.url}")
public void setReportingServiceUrl(String reportUrl) {
reportingServiceUrl = reportUrl;
}

8) Any prior experience with Application cloud migration (Cloud deployment)


9) What do you know about proxy interfaces and classes (Related to Spring
security)
10) What do you know about Retry mechanism in microservices?
https://www.baeldung.com/spring-retry
11) What is Spring AOP?
12) What is YAML Contract. How you write a YAML contract for API documentation.

JPA/Hibernate
1) What is Spring Data JPA and how will you create a Spring Boot application
that communicates with Data base . (We need to explain the step/ hierarchy of
application)
2) How you’ll do relational mapping. Give and example for Many to One ( What
annotations we need to use and how we will map with example)
SQL
1) What are indexes and their advantages?
2) What is curser? Have you ever worked on them.

Project Related
1) How many Microservices in your previous project
2) Explain basic structure of your previous project.
3) How you have implemented inter service communication (Same as Micro service
communication)
4) How you’ve implemented security in your application
5) Have you ever worked on a production related bug fix. How did you analyse it.

Core Java Questions


Differnce between method overloading and method overriding ?
What are the rules for method overriding ? -> then questions based on each rule
What happens if we add final to a class?
How to create immutable class ?
Explain on initialization block and static block ? How these blocks get called ?
Questions on String immutability
-> String str = "java";
String str1 = "java";
Is str == str1 ?

-> String str = new String ("java");


String str1 = "java";
Is str == str1 ?

-> String str = new String ("java");


String str1 = new String ("java");
Is str == str1 ?
How many objects are created in each case?

What are the features of Java 8 ?


What is lambda exp and functional Interface ?
How to create a functional interface and give example
How can we sort Objects ?
How to create singleton class in java?
What the collections used in your project
Explain equals and hashcode contract

Spring Boot Questions

Explain @SpringbootApplication annotation?


Difference between put and patch mapping ?
Use case of get and post mapping
Explain content negotiation? Few questions based on that
What is @ componentScan annoation ?
How do you connect to database in springboot ?
Design a controller class in springboot ?
Explain the different layers in springboot application?
How one microservice communicate with another one microservice?
Explain postForEntity method
What is the way to handle Asynchronous services in Springboot?
How the exceptions are handled in your project?
How to secure an API ?
Questions on structure and working of JWT token
Explain the authentication of header value

Any experience in Jenkins ?

1)how to create immutable class

create immutable class with emp id,name,dob

how do we get access from out side?


2)overriding related question(modifier scope)

3) String s1="emp";
String s2="emp";

s1==s2----? true or flase

4)can parent method throws exception and child method throws io exception ,is it
valid?

5)how to read configuaration proferties in spring boot


6)how to load configuaration proferties at application start up in spring boot
7)put and patch defferences
8)is component scan Annotation can scan child packages?
9)how to send username and pwd in get call in rest
10)why we are using swagger

11)why we are using static method


12)Spring boot flow

They have given one string, asked to arrange in alphabetical order


in that string one letter may have more than one time also
Writing bean scopes in spring bean configuration file and how to access in
application
5:03
and about rest API

1. what all design patherns do you aware of ? explain factory design pattern ?
2. what is singleton pattern ? singleton vs prototype ? how to write / create
singleton class ? if we extend singletonclass will it create more than one objects?

3. What are rules of method overrding ? he gave scenrio like if we have private
method in parent class and can we make it as public in child class ?
4. what is exception hirarchey / exception classes? types of exception ? which
exception needs to be handled?
5. String s1=smita
s2=smita

Q1 . s1==s2 Answer--->false

String s1= new (s)

Q2. s1==s2

Justify your answer.


6.

Class A
{

public A(){ //constructors

print("A") }
}
class B extends A
{
public B() //constructors

{
print("B");
}
}
what will be the output
Q.1. Class B =new class B();
Answer : A,B

Q.2.Class A= new Class B();


Answer : A,B

Q.3. Class A= new classA();


Answer : A

Java- Usage of collections by me , Java thread , child thread and their joining
Mircoservice- types
API definiation
HTTP methods
Implementation of microservice in a business
SOA vs Rest
Security of microservice

7. There is class company with company name ,reg no. Sort arraylist on the basis of
company name using java8 streams.

8. what are get and post methods of http . difference and uses.
9. how to call path variable and query parameter . how to pass in URL .

10. syntax for get method ? how to pass entity , parameters. how to pass username
and password while calling API.
11. what is the annontation used in main class of spring boot application.
12. Rest template is class or interface.?
13. how services are called between two API.
14. what is proxy ?.
15. have you worked in microservices ? Google colud deployements ?
16. is there any limit on number of classes or interfaces can we extends ? what is
that limit ?

How to get object in service class in spring apllication without using autowire
and construction approach?
How to add headers in resttemplate and authentication and authorizarion (differnt
ways).
How to externalize your service and differnt ways .
loadbalace in micro service.
checked and unchecked exception and how to avoid null pointer exception .
Distributed application architectures and design patterns .

How to Throw IllegalArgumentException?

https://www.javaguides.net/2023/07/spring-boot-interview-questions.html
https://www.javaguides.net/2018/11/spring-boot-interview-questions-and-answers.html

You might also like