Java/J2EE Interview question
What are the components of OOPS?
Explain the types of polymorphism
What is StringBuilder and StringBuffer?
Equals and == concept?
Explain Collections?
What is the internal implementation of HashMap?
What is ConcurrentHashMap?
Hash Map vs Hash Table and Hash Map vs Tree Map
Can you write the code for to achieve the IOC.
What is Reflection? Explain with example
What is Recursion? Explain with example
Class Person {
// override only for hashCode() like below
Public int hashCode()
{
return 4
}
}
For the above class ,I have created 100 objects and add it in the map(of the type Map<Person ,String>() );
After adding 100th object what will be the size of the map.
Explain Spring IOC with example?
How we can achieve IOC without Spring?
How will store table data in a Collection?
What is $() in JQuery?
Java oops concept.
Explain Polymorphism and types of polymorphism(Overloading and Riding)
Explain Overloading sample program and explain
Explain Overriding sample Program and explain
How many ways we can create the object for below sample code program and explain which method will get execute?
Class A
{
Public void doSomething()
{
System.out.println(“Hi A”);
}
}
Class B Extends A
{
Public void doSomething()
{
System.out.println(“Hi B”);
}
}
Class C Extends B
{
}
1) String s1=”xyz”;
String s2=”xyz”
String s3 = new String (“xyz”);
How many String literal will be created and objet will be created?
What is the use of hash Code?
Hash Map vs Hash Table and Hash Map vs Tree Map
Differences between String buffer and String Builder
What is IOC?
Class Vehicle
Class Car extends Vehicle
Class Rocket extend Vehicle;
Can you write the code for XML configuration to achieve the IOC.
If Spring IOC is not there then how will you achieve the IOC (by our own).
What is the Recursion and explain the code for summing the number.
You need to create the Data Structure with Java Collection to mimic the below SQL Table Structure and data.
Write the join query for the below
Employee
Department
Abstract classes and Interface when to use abstract class.
How hash map works internally.
What is IOC container
What is the Recursion and explain the code for summing the number.
If Spring IOC is not there then how will you achieve the IOC (by our own).
What are the components used in Extjs and give the example for client side and server side processing with data grid.
Explain the JSON and how used in your project.
What is OOPS,What are the main componet of OOPS, What is polymorphism and how it works in oops.
We have write the code with real time scenario ?
What is association and aggregation ?
What is the internal implementation oh HashMap. How it related to equals and hashcode ?
What will happen if your custom class override the hashcode and always return the same hashcode value, during store into a map ?
Write a program to add N natural number using recursion ?
You have a table data , you have to represent the data in any of the collection object, How will you do ?
you have to write the code for this.
How the Spring will instantiate the Singleton class ?
In future you don't like bean configuration and there is no spring container, than how will you work with your bean , with minimal changes ?
Override equals and hascode method for custom class? Explain the implementation
Point out any Runtime exceptions in implementation
Explain any design pattern that you have implemented in the code.
1. I have Array of values of share prices on daily basis. How will you give the maximum profit that can be generated over a period of time? Explain programatically.
2. Explain the Java Memory Model.
3. Explain how garbage collection internally works in Java and the 3 algorithms. What is the old generation, new generation, what is the difference.
4. If I create the object using new where the object will be allocated? How is the object released.
5. If I have application using heap size of 100 Kb. If this application is facing the memory issue? How will you address it?
6. Will profiler point me to the class name that is causing the out of memory issue? Please explain.
7. What is thread dump vs heap dump?
8. I have created a new thread from main thread. Will my main thread run in parallel? If many methods are being called by main and new thread how does it handle behind the scene while running in parallel.
9. What is thread pool ? what are different types of thread pools? What is the difference between fixed and cached thread pool?
10.What is volatile? I have a class with variable names count. I have 2 threads both updating count variable. What will be the result if count is volatile and not volatile?
11. If I declare the variable as synchronized and I have 2 threads both updating count variable. What will be the result? Will the result be consistent?
12. What is the different between synchronized and volatile?
13. I have collection of Employee objects. Having data members id and name. I want to sort based on id also and name also how do I do that?
14. What is difference between comparator and comparable?
15. I have a TreeSet. I have Employee and Department objects. Both have member, String name and int id. I created 2 different objects. If I store both of them in Set and then iterate over the TreeSet and print them what will be printed?
16. Say you have load millions of objects and later you have to iterate also? Which data structure you will use and why?
17. I want to design a system to which we will get infinite feed of elements. The only job of the system is to provide the top 10 elements? So it has 2 methods. 1 is add() method which stores the element and 2 is getTopTen(). How will you design the system? Which data structures you will use?
I have HashMap. I have Employee object with members id and name. I created Employee object e1 with id=1 and name=”abc” and put it in HashMap with key as e1 and value as e1. Now I create another object e2 with id=1 and name=”abc”. Now I search in hashmap with e2, map.get(e2). What will be the result?
18. What is deadloack? What are the minimum number of object needed to create the deadlock? How do you create the deadlock programatically?
How do I identify that deadlock has happened and how do I resolve the issues?
19. What is atomic operations ? Is ++ operation atomic?
20. Instance variable vs local vs static? How they will behave when multiple threads try to access them
21. Volatile and synchronized keywords and impact of them on variables behavior when multiple threads access them in parallel
21. How to design your own thread pool programatically?
22. If you have abstract class for each part, wheel, seat, etc will you be able to use them in final product . If so can you can explain your design.
23. If you want to count the number of instance of any object how will you do that programatically?
24. Can you explain what is preemtive scheduling and how does it work vs time slicing?
Explain the types of polymorphism
What is StringBuilder and StringBuffer?
Equals and == concept?
Explain Collections?
What is the internal implementation of HashMap?
What is ConcurrentHashMap?
Hash Map vs Hash Table and Hash Map vs Tree Map
Can you write the code for to achieve the IOC.
What is Reflection? Explain with example
What is Recursion? Explain with example
Class Person {
// override only for hashCode() like below
Public int hashCode()
{
return 4
}
}
For the above class ,I have created 100 objects and add it in the map(of the type Map<Person ,String>() );
After adding 100th object what will be the size of the map.
Explain Spring IOC with example?
How we can achieve IOC without Spring?
How will store table data in a Collection?
What is $() in JQuery?
Java oops concept.
Explain Polymorphism and types of polymorphism(Overloading and Riding)
Explain Overloading sample program and explain
Explain Overriding sample Program and explain
How many ways we can create the object for below sample code program and explain which method will get execute?
Class A
{
Public void doSomething()
{
System.out.println(“Hi A”);
}
}
Class B Extends A
{
Public void doSomething()
{
System.out.println(“Hi B”);
}
}
Class C Extends B
{
}
1) String s1=”xyz”;
String s2=”xyz”
String s3 = new String (“xyz”);
How many String literal will be created and objet will be created?
What is the use of hash Code?
Hash Map vs Hash Table and Hash Map vs Tree Map
Differences between String buffer and String Builder
What is IOC?
Class Vehicle
Class Car extends Vehicle
Class Rocket extend Vehicle;
Can you write the code for XML configuration to achieve the IOC.
If Spring IOC is not there then how will you achieve the IOC (by our own).
What is the Recursion and explain the code for summing the number.
You need to create the Data Structure with Java Collection to mimic the below SQL Table Structure and data.
ID
|
Name
|
Age
|
Sex
|
1
|
A
|
50
|
Male
|
2
|
B
|
60
|
Female
|
3
|
C
|
70
|
Female
|
4
|
D
|
80
|
Male
|
Employee
ID
|
Name
|
Age
|
Sex
|
Dept Id
|
1
|
A
|
50
|
Male
|
1
|
2
|
B
|
60
|
Female
|
2
|
3
|
C
|
70
|
Female
|
3
|
4
|
D
|
80
|
Male
|
3
|
Department
ID
|
Dept Name
|
1
|
CSE
|
2
|
EEE
|
3
|
ECE
|
How hash map works internally.
What is IOC container
What is the Recursion and explain the code for summing the number.
If Spring IOC is not there then how will you achieve the IOC (by our own).
What are the components used in Extjs and give the example for client side and server side processing with data grid.
Explain the JSON and how used in your project.
We have write the code with real time scenario ?
What is association and aggregation ?
What is the internal implementation oh HashMap. How it related to equals and hashcode ?
What will happen if your custom class override the hashcode and always return the same hashcode value, during store into a map ?
Write a program to add N natural number using recursion ?
You have a table data , you have to represent the data in any of the collection object, How will you do ?
you have to write the code for this.
How the Spring will instantiate the Singleton class ?
In future you don't like bean configuration and there is no spring container, than how will you work with your bean , with minimal changes ?
Point out any Runtime exceptions in implementation
Explain any design pattern that you have implemented in the code.
1. I have Array of values of share prices on daily basis. How will you give the maximum profit that can be generated over a period of time? Explain programatically.
2. Explain the Java Memory Model.
3. Explain how garbage collection internally works in Java and the 3 algorithms. What is the old generation, new generation, what is the difference.
4. If I create the object using new where the object will be allocated? How is the object released.
5. If I have application using heap size of 100 Kb. If this application is facing the memory issue? How will you address it?
6. Will profiler point me to the class name that is causing the out of memory issue? Please explain.
7. What is thread dump vs heap dump?
8. I have created a new thread from main thread. Will my main thread run in parallel? If many methods are being called by main and new thread how does it handle behind the scene while running in parallel.
9. What is thread pool ? what are different types of thread pools? What is the difference between fixed and cached thread pool?
10.What is volatile? I have a class with variable names count. I have 2 threads both updating count variable. What will be the result if count is volatile and not volatile?
11. If I declare the variable as synchronized and I have 2 threads both updating count variable. What will be the result? Will the result be consistent?
12. What is the different between synchronized and volatile?
13. I have collection of Employee objects. Having data members id and name. I want to sort based on id also and name also how do I do that?
14. What is difference between comparator and comparable?
15. I have a TreeSet. I have Employee and Department objects. Both have member, String name and int id. I created 2 different objects. If I store both of them in Set and then iterate over the TreeSet and print them what will be printed?
16. Say you have load millions of objects and later you have to iterate also? Which data structure you will use and why?
17. I want to design a system to which we will get infinite feed of elements. The only job of the system is to provide the top 10 elements? So it has 2 methods. 1 is add() method which stores the element and 2 is getTopTen(). How will you design the system? Which data structures you will use?
I have HashMap. I have Employee object with members id and name. I created Employee object e1 with id=1 and name=”abc” and put it in HashMap with key as e1 and value as e1. Now I create another object e2 with id=1 and name=”abc”. Now I search in hashmap with e2, map.get(e2). What will be the result?
18. What is deadloack? What are the minimum number of object needed to create the deadlock? How do you create the deadlock programatically?
How do I identify that deadlock has happened and how do I resolve the issues?
19. What is atomic operations ? Is ++ operation atomic?
20. Instance variable vs local vs static? How they will behave when multiple threads try to access them
21. Volatile and synchronized keywords and impact of them on variables behavior when multiple threads access them in parallel
21. How to design your own thread pool programatically?
22. If you have abstract class for each part, wheel, seat, etc will you be able to use them in final product . If so can you can explain your design.
23. If you want to count the number of instance of any object how will you do that programatically?
24. Can you explain what is preemtive scheduling and how does it work vs time slicing?
Comments
Post a Comment