Java Question
Java Question
####Exceptions
Q1 Cases when will finally block execute?
Case 1: If we returning value from try block and there is no exception?
Case 2: If exception is thrown by try block?
Case 3: If exception is thrown by finally as well which exception would be cached?
### serialization
Q1.Difference between Serializable and Externalizable
Q2.What is the use of serlizationVersionId, if we change what are the impacts, if we don't use
that how its calculated?
Q3. What is best way if I change variable to transit, what is the impact of desensitization and
vice versa , If I change the serilaVersionId what is the impact?
Q4 impact of serialization on static variable?
Q5 why static variable are not Serializable?
Q6 If parent class I serialized but child class is not serialized . Then what will happen?
Q7 If child class serialized but parent class is not serialized. Then what will happen?
### Collections and Concurrency
Q1 implement your own concurrent HashMap?
Q2 Difference between concurrent Map and collection.unModifyable synchronized Ma?
Q3 How concurrent hashmap works internally how segments are used by different threads at the
same time.
Q4 Difference between cyclic barrier and count down latch, where we should use the same?
Q5 difference between HashTable and Concurrent HaspMap?
Q6 What is Executor Service and How its works,with use of many threads ?
Q7 Difference between callable and Runnable?
Q8 What is Future Object and why its useful?
Q9 Concurrency and uses ?
Q10 Semaphores in multi threading?
Q11 what are fail safe collections?
Q12 Difference between Comparable and comparator?
Q13 Sort hashmap based on key and based on value?
Java 8
Q1. Difference Between collections and Streams?
Q2 Where we use filters?
Q3 Difference between map and flat-map function?
Q4 Need to write code in java 8 two perform two action on List of string based on certain
condition?
Q5 use of Collect?
Q6 Difference between intermediate and terminal operations?
Q7 If exception thrown by lambda function what will happen?
Q8 Explain Stream API?
Q9 What is lambda expression?
Q10 default method in interface in java 8
Q11 use of Optional class?
Q12 Differences b/w enhanced foreach loop and foreach loop?
Q13 Is Stream be reused?
Q14 What is data type of lambda Expression?
Q 15 What is the purpose of default method in interface?
Q 16 Give the one example of any one pre-defined method?
Q17 What is difference b/w Anonymous class and Stream?
Spring
Q1. How you remove circular dependency?
Q2 Difference b/w Setter and constructor injection, where we should use setter and where
constructor based injection?
Q3 Where we use qualifier anotation?
Q4 What is application-context and what is webcontext and difference.
Q5 What are the Spring containers?
Q6 What us AOP where you used it , cases where we should use and we should not used it?
Q7 How AOP internally works?
Q8 What is Spring IOC Container and what is its role?
Q9 What is controller advise and its uses?
Q10 How can we profiling is done in Spring Boot?
Q11 Autowiring in Spring? Types of autowiring?
Q12 Difference between Dependency injection and IOC?
Q13 When @predestroy() and @postConstruct get called?
Q14 Significance of @sprinbootapplication and what is it equivalent to?
q15 How will you load rootcontext and webcontext in springboot?
Q16 How does AOP proxy work in Spring AOP internal implementation i,e, explain internal of
Spring AOP ? What is the overhead in using AOP.
Q17 Explain Spring MVC interceptors ? Where did you use in your project?
Q18 Lets say that you have rest API that is returning below response one String response e.g {
"name": "myname"
}
now you want to return some other response using same rest end point . What will you do ?how
will you build your services to be backward compatible
{
"name": {
"firstName": " myfirstname ",
"lastName": "my lastname"
}
}
Q19 what is postConstruct in spring?
Q20 How to auto wire if two beans are of same type? If not auto wire it what will happen?
Q21 How to handle the exception in Spring?
Q22 What is @SpringBootApplication?
Q23 If Spring Boot is already have tomcat or JT then what is need of other Server?