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

Java Question

This document contains questions grouped into the following topics: 1. Custom immutable class and cloning, wait vs sleep methods, printing odd/even numbers with threads 2. Exceptions - when finally block executes, serialization vs externalization, impacts of changes 3. Concurrent collections, concurrency, executors, callables, futures 4. Java 8 streams, lambdas, optionals 5. Design patterns, principles like builder and decorator 6. Hibernate, databases, indexing 7. Spring - dependency injection, AOP, MVC 8. Spring security, REST vs SOAP 9. Maven, Git 10. Testing frameworks, Agile, tools 11. Advanced implementation questions on

Uploaded by

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

Java Question

This document contains questions grouped into the following topics: 1. Custom immutable class and cloning, wait vs sleep methods, printing odd/even numbers with threads 2. Exceptions - when finally block executes, serialization vs externalization, impacts of changes 3. Concurrent collections, concurrency, executors, callables, futures 4. Java 8 streams, lambdas, optionals 5. Design patterns, principles like builder and decorator 6. Hibernate, databases, indexing 7. Spring - dependency injection, AOP, MVC 8. Spring security, REST vs SOAP 9. Maven, Git 10. Testing frameworks, Agile, tools 11. Advanced implementation questions on

Uploaded by

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

Java

Q1.Custom immutable class with cloning? - https://dzone.com/articles/how-to-create-an-


immutable-class-in-java

Q2 differences between wait and sleep method ?


Q3 odd and even number print sequentially with the help of two threads?
Q4 Java is call by value or call by references?
Q5 deep copy and shallow copy?
Q6 Lets Say that you have a main thread and 2 more thread ( T1,T2) spawned from it . How will
you handle exception in T1 sitting at main thread?
Q7 Difference b/w run and start method ?

####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?

### Design Pattern and Design Principle


Q1 What is Builder design pattern where we should use it?
Q2 Why we use decorator design pattern?
Q3 Where we should use composite pattern?
Q4 SOLID design principles?
Q5 What is Prototype pattern?
Q6 Explain liskov substitution via code
Q7 What is factory pattern, have you used it?
Q8 What is decorator design pattern, have you used it?
Q9 How to design application like HLD, LLD (class diagram, sequence diagram, ER diagram)?

#### Hibernate and DataBase


Q1 How index are created using query what is algo for it and why we use index?
Q2.Case if we need to created index for gender column value male and female?
Q3.How can we create index on Mongo DB ? (Only for me bcz I have hands on Exp)
Q4. Group By query on Mongo DB ? (Only for me bcz I have hands on Exp)
Q5 Second max salary using SQL?
Q6 differences b/w spring vs spring boot
Q7 what is @embeddable annoation ?
Q8 What is benefit of indexing. Type of indexing?
Q9 difference between primary key and unique key.
Q10 Can you have 2 primary key and 2 unique in a table.
Q11 What is index and its internal working from database?
Q12 Locking in database?
Q13 What is use of index? What is difference b/w index and clustered index?
Q14 what is difference between Procedure and function? How to returns it’s value?

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?

Spring Security And Rest and SOAP


Q1. How you send transactionId in Response Header not in body?
Q2 Create Role Based security design what parameter you need?
Q3 Create Auth 2 security ?
Q4 How you implement security in which Third Party Wallet apps communication with your
banking server?
Q5 How will you manage Rest security?
Q6 difference between rest and soap
Q7 which is more secure soap or rest
Q8 Lets say your rest api is consuming xml but you are sending json in request body. What will
happen and how will you avoid it.You have no option to modify the consume type of rest api.
Q9 How will reduce response time of rest API , say there is a exsiting rest API and its returning
response in 1 second . What will check/ do to resuce response to 0.1 second.
Question on your last project and product?
What is your role and what you have done and challenges you have faced and how you resolve
the same?
MVM and Git
Q1. difference between phase and Goal?
Q2 difference b/w dependency and dependency management is porm.xml?
Q3 What is the use of porm.xml file?

Q4 How you hare reset on Git

Testing and Sprint


Q1. How you do unit testing and its framework?

Q2 What is Jmockit how you have used it?


Q3 While testing which jmockit you create mock object or real one?
Q4 What are the tools you have used for testing?
Q5 What is sprint and how you manage it it Agile ?
Q6 Which tool you used for Sprint

Advance design and implementation questions?


Q1. Implement your own hashMap/Hashtable?
Q2. Implement your own ArrayList?
Q3. Implement Cache Manager with scenerio?
you have key and value and it is a multi threading environment.
purge data from it and load it with fresh data periodically , say each day
finally sort the data in ascending order of key ?
Q4 Implement your ThraadPool?
Q5 Implement your own ReadWrite Lock?
Q6 Create your own blocking Queue?

You might also like