Thursday, December 19, 2013

Franklin Templeton Java Interview Questions

Franklin Templeton Java Interview Questions



What is Just in time compiler?

It is used to improve the performance. JustIinTime compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation.Here the term compiler refers to a updater from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.

What gives Java its 'write once and run anywhere' nature?

The bytecode Java is compiled to be a byte code which is the bridge language between source code and machine code. This byte code is not platorm specific and hence can be fed to any platform.

What is classloader?

The classloader is a subsystem of JavaVirtualMachine that is used to load classes and interfaces.There are many types of classloaders e.g. Bootstrap classloader, Extension classloader, Plugin classloader, System classloader etc.

Is Empty .java file name a correct source file name?

Yes,Let's take a simple example:

  
class A{  
public static void main(String args[]){  
System.out.println("Hello java");  
}  
}  
compile by javac .java
run by java A

What is difference b/w object oriented programming language and object based programming language?

Object based programming languages uses all the features of OOPS except Inheritance. Examples of object based programming languages are  VBScript ,JavaScript etc.

What is the use of default constructor?

The default constructor provides the default skeleton values to the objects. The java compiler creates a default constructor only if there is no constructor in the class

What is a static variable?

static variable is used to refer the common name of all objects (that is not unique for each object) static variable gets memory only once in class area at the time of class loading.

Is main method is static? If Yes Why?

Yes, because object is not have to call static method, if It were non-static methods ,jvm creats object first then call main() method that will lead to the problem of extra memory allocation.

What is difference b/w aggregation and composition?

Aggregation describes as  weak relationship but composition represents strong relationship. 

 How will you go about fixing memory leaks in Java?
Again, a very common problem, and a thorough answer will go a long way in securing your next Java job.
Detecting and fixing memory leak issues in Java. Tools and techniques to detect memory leaks in Java.
Memory profiling in Java. Tutorial on memory profiling a Java application.

How do you deal with dependency issues?
This question is purposely ambiguous. It can refer to solving the dependency injection problem (Guice is a standard tool to help). It can also refer to project dependencies — using external, third-party libraries. Tools like Maven and Gradle help manage them. You should consider learning more about Maven as a way to prepare for this question.

 What is type erasure?
Type erasure is a JVM phenomenon that means that the runtime has no knowledge of the types of generic objects, like List<Integer> (the runtime sees all List objects as having the same type, List<Object>).

What are the differences between Map, Hashtable, HashMap, TreeMap, ConcurrentHashMap, LinkedHashMap?

Map is an interface for a key-value map
HashMap is a Map that uses a hash table for its implementation
Hashtable is a synchronized version of HashMap
TreeMap uses a tree to implement a map
ConcurrentHashMap allows for multiple threads to access it at the same time safely
LinkedHashMap preserves the iteration order that things were inserted in (others don’t provide a fixed iteration order)

What is Collection API ?

The Collection API is a bunch of classes and interfaces that support operation on collections of objects. These classes are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables if effectively replaces. 
Example of classes: HashSet, HashMap, ArrayList etc.
Example of interfaces: Collection, Set, List and Map.

How to define an Abstract class? 

A class having abstract method is called Abstract class. An Abstract class can't be instantiated.
Example :
abstract class testAbstractClass {
protected String myString; 
public String getMyString() { 
return myString; 
public abstract string anyAbstractFunction();
}