Java Experience Developer/Lead Developer Interview Questions List : In this article more than 10 companies question is covered

Chaudhary Vivek Kadiyan
7 min readJan 25, 2024

--

Note: Java/Spring boot is a verbose tech stack to cover in 1 article but i tried my best to cover all interview questions which all are asked to me till now. So you can also go through the same and check your preparation. If you want me to write another article to provide solution for all the questions, Please give your valuable input in the comments

Questions

Question 1 : How will you simulate concurrent modification through stream API ?

Question 2 : How many thread will open for parallel stream and how parallel stream internally works ?

Question 3 : How does Executor make or check , number of threads are active or dead , in other word what is internal working of thread pool executor ?

Question 4 : Kindly give brief idea about JAVA memory model.

Question 5 : What are the changes of pegmen in JDK 8. (PermGen and Meta)?

Question 6 : What is the difference between normal REST service and Restful WS (Web Service)?

Question 7 : What are the different types of Http methods and their differences ?

Question 8 : What is DDOS(denial of service ) attack and how will we prevent from this in our Applications ?

Question 9 : What is Method Reference and Functional Interface ?

Question 10 : Please define Overridden rules for default/static method in java 8.

Question 11 : Questions Related to JAVA Design Patterns mainly
Creational Design Patters
i) Singleton
ii) Builder
iii)Factory
iv) Prototype

Structural Design Patterns
i) Adaptor
ii) Bridge
iii)Proxy
iv) Decorator

Behavioral Design Patterns
i) Chain of Responsibility
ii) Observer
iii) Strategy

Question 12 : How will you secure your API’s ?

Question 13 : Please give brief description about hashcode() and equals() ? follow up question will be if 1 is overridden and another not vice versa in the reference of customized object while using map?

Question 14 : Internal Working of HashMap and HashSet?

Question 15 : How will you enable cache in spring boot microservices project , or what all annotation you can use to implement the same ?

Question 16 : Please describe , how Kafka works and what is consumer groups while using Kafka ?

Question 17 : Please tell us about what all design patterns you have used to design your microservices application ? Mainly
i) Circuit Breaker
ii) SAGA
iii) CQRS
iv) Two phase commit

Question 18 : what is database sharding ?

Question 19 : Difference between (RDMS) SQL and No SQL ?

Question 20 : What is apache spark ? use of apache spark with spring boot application ?

Question 21 : What is traceId and span Id in spring boot microservice application and what is use of these id’s ?

Question 22 : what is webflux and mono in spring boot ?

Question 23 : How will you create custom immutable class ? follow up question can be as String is immutable class can you prove that with some code snippet ?

Question 24 : What are the time/space complexities for collection classes and name their internal underline data structure?

Question 25 : What all concurrent collection class have you used in your application and what improvement has been done in collection classes from Java 8 onwards ?

Question 26 : What all improvement for IO in java 8 ?

Question 27 : How will enable and disable auto configuration in spring boot ?

Question 28 : What is use of actuator and how will you customized the same ?

Question 29 : How will you create custom annotation ?

Question 30 : What & why do we use Kubernetes and tell me about its cluster , Node , POD etc. ?

Question 31 : What will you use for Application Resilience ?

Question 32 : If any data base table has name , id column then please write a query to find even rows ?

Question 33 : Name of algorithm use by Arrays.sort(..) and Collections.sort(..)

Question 34 : Why do we use serialVersionUID ?

Question 35 : How can you prevent cyclic dependency in spring ?

Question 36 : Is this possiable to decrease the size of a docker image ?

Question 37 : How can we break singleton class ? what is single object creation strategy ?

Question 38 : What is deep and shallow cloning and give the use of Cloanable interface ?

Question 39 : Why do we use builder design pattern rather not to choose use constructor base object creation ?

Question 40 : How will you make two ambiguity URL working in spring boot without changing the http method type and no change will be accepted in URL as well ?

Question 41 : What is your application deployment structure ?

Question 42 : Describe the use of CompletableFuture ?

Question 43 : Use of String.join(….) in java 8?

Coding Problems

Excel Your Coding Skills

Question 1 : Write a program to find the duplicate characters in list of string . Only java stream will be accepted ?

Question 2 : Find the duplicate element and its occurrence in a given string ? Only java stream will be accepted ?

Question 3 : You have an arrays of zeros (0) and (1) keep all zeros at the left hand side and all 1 to right hand side ?
e.g Integer array[] =[1,1,0,1,0] -> output : [0,0,1,1,1]

Question 4 : Find the continuous sequences of numbers in given input . Provide all possiable test?
e.g input 1 2 3 5 9 a 6 7 8 4 @ -5 -7 -3 -2 -1
output
1 2 3
6 7 8
-3 -2 -1

Question 5 : Find Nth salary in given map . Only Java 8 stream solution will be accepted
e.g
Student has name and salary
Map will be like Map<String , Student >

Question 6 :Given a list of N students, every student is marked for M subjects. Each student is denoted by an index value. Their teacher Ms. Margaret must ignore the marks of any 1 subject for every student. For this she decides to ignore the subject which has the lowest class average.
Your task is to help her find that subject, calculate the total marks of each student in all the other subjects and then finally return the array of the total marks scored by each student.
Input Specification:
input1:
An integer value N denoting number of students
input2:
An integer value M denoting number of subjects
input3:
A 2-D integer array of size N’M containing the marks of all students in each subject.
Output Specification:
Return an integer array of size N containing the total marks of each student afte deducting the score for that one subject.
Input :
3 5
75 76 65 87 87
78 76 68 56 89
67 87 78 77 65
Output:
325 299 296

Question 7 : Write a program to find unique elements in given string by JAVA streams.

Question 8 : Write a program to find first non repeat element from a given string by Java Streams.

Question 9 : Write a program to find second highest element from an array , Array can contain duplicate elements . Solve it by stream java 8.

Question 10 : Write a program to find first repeat element/character from a given string by Java Streams.

Question 11 : Write a program to find longest string in a given array.

Question 12 : Write a Java program to find all elements from array which starts from 2 using stream API.

Question 13 : Given an expression string exp, write a program to examine whether the pairs and the orders of “{“, “}”, “(“, “)”, “[“, “]” are correct in the given expression.

Example:

Input: exp = “[()]{}{[()()]()}”
Output: Balanced
Explanation: all the brackets are well-formed

Input: exp = “[(])”
Output: Not Balanced
Explanation: 1 and 4 brackets are not balanced because
there is a closing ‘]’ before the closing ‘(‘

public class CodingProblem13 {
public static void main(String[] args) {
String inputString = "[(]{}{[()()]()}";//Need to check whether this string is balance parenthesis string
System.out.println("Result:::"+isBalancedInput(inputString));
}
private static String isBalancedInput(String input) {

//Stack<Character> stack = new Stack<>();//stack is synchronized so we can use Deque also
Deque<Character> stack =new ArrayDeque<>();
for(int i=0;i<input.length();i++) {
if(!(input.charAt(i) == '}' || input.charAt(i) == ']' || input.charAt(i) == ')') ){
stack.push(input.charAt(i));
}

if((input.charAt(i) == '}' || input.charAt(i) == ']' || input.charAt(i) == ')')) {
if(stack.isEmpty())
return "Not Balanced ";
char top = stack.pop();

// Check if the popped opening bracket matches the current closing bracket
if ((input.charAt(i) == ')' && top != '(') ||
(input.charAt(i) == ']' && top != '[') ||
(input.charAt(i) == '}' && top != '{')) {
return "Not Balanced ";
}
}
}
return stack.isEmpty() ? "Balanced" : "Not Balanced ";
}
}

Thanks to read this article , please provide valuable feedback/suggestions for the same .

Best of Luck for your preparations and interviews…………………

Don’t forget to clap for the article.

Another Knowledge sharing content you can have a look

--

--