Java + Spring Questions
Java + Spring Questions
2Project overview.
3Project related questions.
4Have you used web security in web service implementation ?
5Authentication and authorization in Web services.
6Explain SSL ?
7Have you used Stored Procedures ?
8Have you used tree set ?
9Have you heard of Object Cloning in Java ?
Have you used Synchronization in Java ? Which keyword is used and can it be
10
applied on class ?
11How can I implement multithreading in Java with 30 threads ?
12Have you used HashMap in Java ? Can they Key be integer or a string or a class?
23 How will you inject dependent beans? (by using xml and by using annotations)
26. Do you have experience in restful webservice framework?
27. Do you have production support experience?
28. What kind of queries , you get on daily basis in production support?
29. How do you figure out data missing?
30. Do you have production database access?
31. When error occurs in production environment, do you check log file or Database tables?
32. Which application server , do you use?
33. Do you know unix?
34. How to search keyword in a log file in unix?
35. What is ‘grep’ in unix?
36. How to check the process which are running?
Core Java
1. class loaders in java
2. dependency injection
3. what are different access & non access modifiers in java?
4. abstract class vs final class diff?
5. Singleton class vs Static Class?
5. what is the meaning of static class , method and variable?
6. what is meaning of final class, method and variable?
7. collection hierarchy and types of collection interfaces & differences
7. what are the methods to sort collections for primitive types, classes (both natural and custom sort
) - colletions.sort , comparable and comparator are used.
8. what is difference between hashmap vs treemap vs linkedhashmap vs Hashtable
9. what is difference between arraylist vs linkedlist vs vector
10. what is difference between enumeration vs iterator vs listiterator vs spliterator
11. what is difference between comparator vs comparable
12. what is logic of storing and retrieving objects from hashmap?
13. what are java features used 1.8?
a. what is the use of Stream API?
b. what is default methods in java 8
c. what is a lambda expression
d. what is an functional interface?
14. Explain Exception hierarchy (Throwable ->Exceptions & Error)
15. collection hierarchy (Iterable ->Collection-> List, Set, Queue -> ArrayList,LinkedList , HashSet,
TreeSet PriorityQueue.
16. how to create a thread?
17. thread life cycle?
18. What is Executor framework in java 1.5 ?
4. what is synchronized used for?
19. Lock API vs Synchronization?
19. Overloading vs overriding
20. what is covariant type
21. overloading rules for access and non access modifiers?
22. Deep copy vs shallow copy (Obj.clone -> Deep copy vs Class A obj = new A() ; B obj =
A; ->Shallow copy)
23.Heap memory vs Stack memory (What is stored in heap vs stack and how memory allocation
is done in both)
23. Static vs singleton memory allocation.
Hibernate Questions:
1. What is Hybernate used?
2. How to integrate Hybernate with Spring.
· Add hibernate-entitymanager, hibernate-core and spring-orm
dependencies.
· Create Model classes and corresponding DAO implementations for
database operations. Note that DAO classes will use SessionFactory that will
be injected by Spring Bean configuration.
· If you are using Hibernate 3, you need to configure
org.springframework.orm.hibernate3.LocalSessionFactoryBean or
org.springframework.orm.hibernate3.annotation.AnnotationSessionFactory
Bean in Spring Bean configuration file. For Hibernate 4, there is single class
org.springframework.orm.hibernate4.LocalSessionFactoryBean that should
be configured.
· Note that we don’t need to use Hibernate Transaction Management,
we can leave it to Spring declarative transaction management using
@Transactional annotation.
3. Session.Load vs Session.Get
4. What are different states of an entity bean? (Transient, Persistent and Detached.
Explain each state)
5. Different Annotations purpose
· javax.persistence.Entity: Used with model classes to specify that they are entity
beans.
· javax.persistence.Table: Used with entity beans to define the corresponding
table name in database.
· javax.persistence.Access: Used to define the access type, either field or
property. Default value is field and if you want hibernate to use getter/setter
methods then you need to set it to property.
· javax.persistence.Id: Used to define the primary key in the entity bean.
· javax.persistence.EmbeddedId: Used to define composite primary key in the
entity bean.
· javax.persistence.Column: Used to define the column name in database table.
· javax.persistence.GeneratedValue: Used to define the strategy to be used for
generation of primary key. Used in conjunction with
javax.persistence.GenerationType enum.
· javax.persistence.OneToOne: Used to define the one-to-one mapping between
two entity beans. We have other similar annotations as OneToMany, ManyToOne
and ManyToMany
· org.hibernate.annotations.Cascade: Used to define the cascading between two
entity beans, used with mappings. It works in conjunction with
org.hibernate.annotations.CascadeType
· javax.persistence.PrimaryKeyJoinColumn: Used to define the property for
foreign key. Used with org.hibernate.annotations.GenericGenerator and
org.hibernate.annotations.Parameter
SQL/DB
1. Explain DDL/DML/DCL statements
2. Diff between Truncate and delete
3. procedure vs function
4. Table vs View
5. What are different joins?
6. Index
7. clustered vs non-clustered index
8. WHERE clause vs Having clause (Having is used with Group by )
Design patterns: Core J2EE patterns
Please read 2 presentation tier, 2 business tier and 2 integration tier pattern & understand why it is
used.
http://www.corej2eepatterns.com/
Gang Of Four Design patterns:
Please read 2 creational, 2 structural and 2 behavioural patterns & understand why it is used.
https://springframework.guru/gang-of-four-design-patterns/
SOLID Principles: (This is optinal but you can explain using these principles if they ask any questions
on code reviews. You can explain using these principles)
https://en.wikipedia.org/wiki/SOLID
1. Observable
2. Observer
3. Cyclicbarrier
4. Countdownlatch.
1st round:
--If you have large amount of data in CSV file and How are you going handle that data
--What's the importance of hashcode and equals methods in java
-- How you will sort the customized the employee class and how you will implement the
employee class
--What kind of work you have done in Hibernate
--If you have department and employee(one to many) relationships and How are you going
to design the relationships in hibernate.
--How can we get only department details and any idean on cascading and lazy loading in
hibernate.
--Have you published any webserrvice
--How can we consume the web service
--We have wsdl file and how can we consume the externala web service operations.
--Are you familiar with Jboss server--
--Do you have any experience in SQL and are you good in basic joins in SQL
2nd round
-- Brief introduction about on you.
--what are the tools and technologies you worked on ur previous exp
--What kind of work you have done earlier
--Have you worked on threads
--We have some tasks to handle the large amount of data and how are going to handle with
threading.
--We have employee(id,name and adddres) with 1000 employee objects and how to convert
employee list to map and how are going to form the key and value pair.
--How to interate the dat from the list
--What's serializable interface and why do we need serializable interface
--Do you know the Garbage collection?
--How you be able to fix the garbage collection and memory leak issues?
--Do you know how enforce the garbage collection in java
--Do you know memory leaks in java and when it will be popup.
--How to read the native SQL queries in hibernate
--How does micro service interact with other exterrnal service.
--How do you test the rest serrvice
--how do you authenticate the microservice any idea?
3r round
--You have millions of data in database and how are going to design the rest service with
search 'ABC' key
--If System goes with OOO error and how are you going to handle this scenario.
--How garbage collection will work in java
--How are you going to design the cache for repeated objects.
--Differntiate the runtime exception and checked exception in java
--Do you know the exception bundling and How are you going hadle the exception in nth
method
ex: a->b->c->d exception occured in d method and how are you going to handle this
scenario.
--Have you worked on UI framework?
--What's the security mecanisam you have used in your project