Professional Documents
Culture Documents
1. Collection
i. Set
ii. Linkedlist
iii. Hashset
iv. hashmap vs linkedhhashmap
v. hashmap vs hastable
vi. fail fast vs failsafe
2. when we have abstract class then why should go for interface?
3. Difference between Exception and Error.
4. Singleton class and its all implementation.
5. Executer Service.
6. why should we go for synchronization.
7. method overloading and overriding.
8. Constructor and instance method.
9. interface.
10. Interface & abstract class ?
Answer: Interface is a special type of class through which we can achive fully abstraction runtime
polymorphisim and multiple inheritance which makes our code completely loose coupled but in
abstract class also we can achive abstraction and R.P but partially..coz it contains both abstract method
as well as concret method but in abstract class u can't get multiple inheritance
11. To override all the method from super which keyword we have to use.and why
Answer : implements keyword coz class+interface== always implements
12. Why abstract class achive less abstraction why not interface.?
Answer : Cause Abstract class contain boh concrete and abstract method but it's not mandatory that
My subclass always override supperclass method so there is no guarentee to achive fully abstraction
13. What is abstraction
Answer: Hide the implementation Provide only Functionality is called abstraction
14. How to create own immutable class write code?
public class MyImmutable {
int no;
public MyImmutable(int no) {
super();
this.no = no;
}
public MyImmutable modify(int no) {
if (this.no == no) {
return this;
} else {
return new MyImmutable(no);
}
}
}
15. Why List allow duplicate why not Set with internal ?
Answer : Coz List internally follw Array Concept so no there is no restriction in array to allow duplicate
but in case of Set it internally follow Map which object u add in set it will be placed as key in That
internal Map so duplicate not allowed in Set Just explain the flow of Map ok if he ask more.....
16. What is the difference between CountDownLatch and CyclicBarrier. (Answer)
17. What is the time complexity of put() and get() operation in HashMap? (Answer)
18. Why do we need thredpool in Java Application? (Answer)
19. What is the time complexity of put() and get() operations in ConcurrentHashMap?
20. How ConcurrentHashMap works internally?
21. If Concurrency level of ConcurrentHashMap is 4, can more than four thread read simultaneously from
ConcurrentHashMap?
Answer : Yes. Any number of threads can read concurrently from ConcurrentHashMap.
22. If one thread is writing in one segment of ConcurrentHashMap, Can other thread read from that
segment?
Answer : Yes. In that case, reading thread will read last updated value as value field is volatile in
ConcurrentHashMap entry object.
23. What is the difference between synchronized keyword and ReentrantLock? Advantages of
ReentrantLock over synchronized keyword.
24. Print 1 to 20 numbers using two different threads concurrently.
Thread 1 prints 1, 3, 5, 7,…,19
Thread 2 prints 2, 4, 6, 8,…,20
25. Find the intersection of two singly linked list?
For Example,
First LinkedList : 1 -> 2 -> 3 -> 4 -> 5
Second LinkedList : 10 -> 9 -> 8 -> 7 -> 4 -> 5
LinnkedList InterSection - Wissen Infotech Interview Questions – Set 1
Answer should be 4 i.e. both the lists are same after 4.
26. Suppose, I have class Employee with three fields as below:
class Employee{
int empId;
String empName;
Address empAddress;
}
class Address{
}
– How will I make Employee as Immutable class.
– If Address is also a mutable object. How will you handle it?
Spring
1. Bean Scopes
2. @Transaction
3. Advice
4. AutoWiring
5. @Qualifier
6. MVC Architechture
7. ParameterazableViewController
8. SimpleFormController
9. Security and How to configure and enable.
10. Why session open?
11. can we open multiple session and why?
12. Hbm to DDL.auto properties
13. Application context
14. @Entity use.
15. What is Dependency Injection ?
Answer : Dependency Injection is a process of inject dependency in Dependant class automatically we no
need create object and no need to map with object .it internally follow Strategy design pattern.
16. What is autoware,Type explain with sample code
Answer : Autowire is auto enable dependency Inject it is 3 type:1)byName 2)byType
3)Constructor
17. Which version of spring you have used ?
18. Write Spring-transaction configuration?
<aop:config>
<aop:pointcut expression="execution(*com.dt.service.ManageEmployeeService.*(..))"
id="manageEmpPct"/>
<aop:advisor advice-ref="manageEmployeeTxAdvice" pointcut-ref="manageEmpPct"/>
</aop:config>
<tx:advice id="manageEmployeeTxAdvice">
<tx:attributes>
<tx:method name="new*" read-only="false" propagation="REQUIRED" />
<tx:method name="*" read-only="true" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
Hibernate
1. Hibernet template
2. how to map hibernet in xml.
3. What is First Level Caching in Hibernate?
4. How you will create OneToMany relationship in Hibernate?
5. What are the different state of Hibernate POJO?
6. What is transient state?
7. What is Cascade Attribute In Hibernate?
8. I'd generators
9. Second level cache
10. Merge vs persist
11. Assosiation Mappings
12. Need of Lazy load
13. Get vs Load
Web Services
1) Difference between POST and PUT method.
2) Where have you used WebServices in your application?
3) What is swagger how you are using it.
4) How many policy are their in oauth2
5) What is JSON webtoken?
6) Which class we configure in web.xml as front controller in Jersey?
Design Pattern
1. Do you know about SOLID design principles? Explain.
Project
1) How can u achive Abstraction With Real Time Example(Project) ?
Answer : As per my project what we people are developed that will be hidden from user so for them it is
abstraction otherwise explain Hari sir Bank Atm example.
2) In your Project Where u are using oops concept..?
Answer : Ya we implement all the concept in our project and Encapsulation we used in Business Object or
Model class Inheritance and Polymorphisim we implement in Dao and Service Layer to make it loosly
coupled
3) Encapsulation u are using in ur project in which layer. ?
Answer : Ya we are using In Model layer (BO,DTO,FORM)
4) Write 5 classes which u r develope in your project with fully qualified name ?
Just mention as below
1. MODULE_NAME_DAO---------com.productOwnersortname.module.layer
2. MODULE_NAME_SERVICE
3. MODULE_NAME_CONTROLLER
4. MODULE_NAME_BO
5. MODULE_NAME_DTO
6. MODULE_NAME_MAPPER
7. MODULE_NAME_UTIL
5) What are the exception u face in ur project development and how u resolve them explain ?
1.NullPointerException:-Resolve by Remote Debugging
2.DataAccessException:-Enter the Column name properly this exception from DAO
3.ClassCastException:-Mentain Typecast or Generics properly
6) Why u are using Spring-jdbc why not hibernate ?
Answer :Coz my project is Intranet Application and it handles huge amount of data for persist and retrive
thats why we are using Spring-Jdbc.
7) Which security u are using..?
Answer :Simple Authentication by using Spring
8) Level of log(Which one u use in your project)
Answer : DEBUG,ERROR,WARN
9) What is singletone ,In your project did u use singletone ,Where write code ?
Answer :Singleton is object creation design pattern by which we can instantiate only one instance per one
class per one jvm. In my project i didn't use coz we are using Spring so every bean scope is singleton so
we no need to make explicitly singleton.
10) Which type of Injection u are using in ur project and why..
Answer : We are using both setter and constructor injection both coz some fields we need to compulsory
inject and some fields are optional for our project .
11) What are the annotation u are using in ur project ?
12) Tell me about your current Project.
13)
Answer: @Componet, @Service, @Controller, @Autowire, @Transactional, @Scope,
@ControllerAdvice,@ExceptionHandler, @RequestParm, @PathVariable, @ModelAttribute,
@PropertyResource
14) What is ur daily activity in ur working environment
ans:Sensiourly working in service and dao based on user story code testing and write junit test case and test
it 2 to 3 times participate in daily-Scrum
15) Aop , types of advices and what is programmatic vs declarative approach , how you used in your project.
16) Spring security how you used in your project?
SQL
1. What is the difference between clustered and non-clustered index?
2. What is the use of group by and having Clause?
3. Explain all types of joins in database.
4. What is SQL Injection? Which feature of JDBC can we use to prevent SQL Injection?
5. For below given SQL Table
EMP_ID EMPLOYEE_NAME MGR_ID
100 Prateek –
101 Kapil 100
102 Prakash 101
103 Jack 101
6. Write a query to fetch result as below
EMPLOYEE_NAME MANAGER_NAME
Prateek –
Kapil Prateek
Prakash Kapil
Jack Kapil
7. What all database constraint do you know?
8. Is it possible to create Composite Unique Key? Or It can be created only on one table?
9. Difference between clustered Index and Non clustered Index.