java developer interview experience in JP Morgan Chase,Hyderabad,India

Attended interview in jp morgan chase,Hyderabad for java developer position on 07-June-2016.

HR Mr Harshavardhan called and scheduled interview.He told me that it is f2f but it was written test with two questions.
one is sql question and one more is java question.
Questions 1. Implement a cache application in java. Which stores student results information rank wise.

Rank Name Marks Percentage
1 Chinna 80 80%
2 Mahi 70 75%

StudentResults should be inserted into cache rank wise.
public interface MyCache{
public void addCache(StudentResults std);
public StudentResults readFromCache(String rank);
public void removeFromCache(String rank);

Business Rules: 1. While adding we have to check wether cache exists already or not,if not you have to create only one object of cache and add first element into cache.
2. If cache size is 20 or more than 20, then remove least used element from cache and add new element into cache.
3. While reading if cache is empty, read first 10 student results from text file into cache.

Question 2.
List out the employees details whose comulative salary(sum of the salary of all months) is greater than or equal to 300.
Project details of each employee month wise.

id name
1 Ram
2 Naresh
3 Rajesh


id month Salary
1 Jan 100
1 Mar 100
1 July 200
2 Jan 100
2 Sep 200
3 Dec 200

Out put:

ename month sal
Ram Jan 100
Ram Mar 100
Ram July 200
Naresh Jan 100
Naresh Sep 200

LR1 interview questions
1. Tell me about your self and technical background.?
2. Is it development project or production support.? How much time your spend on writting code.?
3. What is the solution you written for problem written test, can you explain once.?
4. Why you used treemap in the solution here instead of hashmap.?
5. In which order data will be stored in hashmap.?
6. How you maintain singleton object for cache object(question asked in written to create cache mechanism).
7. When there are multiple synchronized methods in one class. Is it possible multiple threads access different methods parallally.? Where exactly lock happends.? Answer
8. How many objects of a servlet will be created by app server.?
9. You are saying only one object will be created, then how it handle multiple requests at the sametime.?
10.What is the difference between branch and tag.?
11.Asked one question in junit. I donnot remember it.
12.What is the use of spring. Which scope used in your project mostly in spring.?
13.Where you used singleton scope and where you used prototype.?
14. What are the linux commands you know.? I said ps command
15. How you configm server is up or down by using ps command
LR2 interview questions:
Mr Kundan taken LR2, It was skype interview.
1. In which are you are strong in core java.?
2. Java is call by reference or call by value.?
Shown some code snippets and asked expected output(Related to call by value).

StringBuffer sbf=new StringBuffer(“A”);
sysout(sbf); —>1
sysout(sbf); —>2
public void callme(StringBuffer sbf){
sysout(sbf); —->3
What will be print in above statements.?

What will happen if we declare sbf as final variable.
3. What will happen if you declare static variable as final.
4. final StringBuffer sbf=new StringBuffer(“A”);
sysout(sbf); —>1
sysout(sbf); —>2
public void callme(StringBuffer sbf){
sbf=new StringBuffer(“Y”);
sysout(sbf); —->3
What is the output of above program.
5. class A{

public static void method1(){
sysout(“class A method1”);


class B extends A{

public static void method1(){
sysout(“class B method1”);

A a=new B();
B b=new B();
B b1=new A();
6. How you write immutable object.?
7. How to increase the heapsize of your app server jvm.?
8. What is the heap size of your jvm.?
9. How you decide required heap size for your application.?
10.Is arrylist threadsafe.?
11. How to get threadsafe arralist.? I said Collections.getsynchronizedArrayList(list).
12. Collections.getsynchronizedArrayList(list) gaurantee the threadsafty of arraylist.?
13. int a=(Integer)al.get(0)/b;
What are the exceptions can come by executing above program and what is the hierarchy we have to follow while catching.
14. When we have to follow exception hierarchy in catch block.
15. How one servlet is able to handle multiple requests and what is the care we have to take while writting servlets.?
16. What are the linux commands you know.?
17. What are the new features in java 1.8
18. I have value 0 in multiple palces of arraylist.How you remove 0 from arraylist.