TCS Java interview
Company TCS
Mode Telephonic
Duration 25 minutes
Contributed By Raman
Candidate's Profile 4 Years of experience in Java and J2EE

Tell me about yourself?

Explain about your current project.

You seem to have spent nearly 18 months in the same project!!
It includes both development and support phase.

How many people work on the project?
Now 6 people support. But during peak development more than 18 people worked on it.

What are your roles and responsibilities with respect to the current project?

Can we start with core java?

What is the difference between pass by value and pass by reference?

Can a reference be passed across JVM's?
No. An object reference is valid only within the JVM.

What is an Interface?
Interfaces are used to enforce standard definitions without bothering about the actual implementation.

How about abstract class?
Abstract class also does the same work of providing abstraction but it might also have some concrete implementation which might be common for all the instances of the class.

So you mean to say that abstract classes can be instantiated?
No. I meant instances of the concrete sub-classes of the abstract classes.

In Java, String Objects are said to be immutable. Can you explain the statement with an example.

Difference between Hashtable and Hashmap?
Important difference is Hashtable is sychronized but Hashmap is not synchronized.

Can a class be synchronized?
No. By synchronized class, I mean that all the methods in Hashtable are synchronized.

Okay what are other differences..
Hashmap allows null values but Hashtable doesn't allow null values.

Can a key be null in Hashmap?
I dont think so.

You mentioned exposure to performance tuning. Say i have a pure java based batch service which is taking 20 minutes to complete. I want the time to be reduced to 10 minutes. On a upper level, what will you look at in the code?
I will look at DB parameters, OS parameters and Application server level parameters..

No i am not asking about other parameters, just tell me what will you do at the code level.
I will try to understand the business and try to cut out unwanted calls. Look sql queries and try to optimise them by using existing indexes or creating new indexes. Check for non-conformance to coding standards. Check for proper handling db cursors, statements, resultsets and connections.. I will run Java profiler...

What is the difference between Singleton and normal static block of code ?
Singleton is the concept having single instance of the class for the entire JVM. Whereas static block of code is and execution mechanism where the static block will get executed at the time class loading. I think singleton can also be acheived using static block. But it depends on what data is required to be held in the singleton.

What are the advantages of Service Locator pattern ?

Why are you leaving your current job?

We are done, do you have any questions?