Infosys Core Java Placement Papers - Infosys Core Java Interview Questions and Answers updated on 23.Jul.2024

Q1. What Is A Thread?

Thread is a block of code which can execute concurrently with other threads in the JVM.

Q2. What Is Singleton?

It is one of the design pattern. This falls in the creational pattern of the design pattern. There will be only one instance for that entire JVM. You can achieve this by having the private constructor in the class.

For eg.,

public class Singleton

{

private static final Singleton s = new Singleton();

private Singleton()

{

}

public static Singleton getInstance()

{

return s;

}

// all non static methods …

}

Q3. What Is The Purpose Of Assert Keyword Used In Jdk1.4.x?

In order to validate certain expressions. It effectively replaces the if block and automatically throws the AssertionError on failure. This keyword should be used for the critical arguments. Meaning, without that the method does nothing.

Q4. What Is The Protocol Used By Rmi?

RMI-IIOP

Q5. Can You Instantiate The Math Class?

You can’t instantiate the math class. All the methods in this class are static. And the constructor is not public.

Q6. Does The Jdbc-odbc Bridge Support Multiple Concurrent Open Statements Per Connection?

No

Q7. Is Jdbc-odbc Bridge Multi-threaded?

No

Q8. What Interface Do You Implement To Do The Sorting?

Comparable

Q9. What Is The Algorithm Used In Thread Scheduling?

Fixed priority scheduling.

Q10. What Is The Use Of Serializable?

To persist the state of an object into any perminant storage device.

Q11. What Do You Mean By Rmi And How It Is Useful?

RMI is a remote method invocation. Using RMI, you can work with remote object. The function calls are as though you are invoking a local variable. So it gives you a impression that you are working really with a object that resides within your own JVM though it is somewhere.

Q12. What Is The Major Difference Between Linkedlist And Arraylist?

LinkedList are meant for sequential accessing. ArrayList are meant for random accessing.

Q13. What Is The Final Keyword Denotes?

final keyword denotes that it is the final implementation for that method or variable or class. You can’t override that method/variable/class any more.

Q14. What Is Nested Class?

If all the methods of a inner class is static then it is a nested class.

Q15. What Is Composition?

Holding the reference of the other class within some other class is known as composition.

Q16. What Is The Significance Of Listiterator?

You can iterator back and forth.

Q17. What Are The Different Driver Types Available In Jdbc?

  1. A JDBC-ODBC bridge
  2. A native-API partly Java technology-enabled driver
  3. A net-protocol fully Java technology-enabled driver
  4. A native-protocol fully Java technology-enabled driver For more information.

Q18. What Is Inner Class?

If the methods of the inner class can only be accessed via the instance of the inner class, then it is called inner class.>

Q19. What Is Skeleton And Stub? What Is The Purpose Of Those?

Stub is a client side representation of the server, which takes care of communicating with the remote server. Skeleton is the server side representation. But that is no more in use… it is deprecated long before in JDK.

Q20. What Is Hash-collision In Hashtable And How It Is Handled In Java?

Two different keys with the same hash value. Two different entries will be kept in a single hash bucket to avoid the collision.

Q21. What Is A Marker Interface?

An interface with no methods.

Example: Serializable, Remote, Cloneable

Q22. What Is Class.forname() Does And How It Is Useful?

It loads the class into the ClassLoader. It returns the Class. Using that you can get the instance ( “class-instance”.newInstance() ).

Q23. What Is Driver Manager?

The basic service to manage set of JDBC drivers.

Q24. What Are The Methods In Object?

clone, equals, wait, finalize, getClass, hashCode, notify, notifyAll, toString

Q25. What Is The Purpose Of Abstract Class?

It is not an instantiable class. It provides the concrete implementation for some/all the methods. So that they can reuse the concrete functionality by inheriting the abstract class.

Q26. How Will You Get The Platform Dependent Values Like Line Separator, Path Separator, Etc., ?

Using Sytem.getProperty(…) (line.separator, path.separator, …)

Q27. What Is Aggregation?

It is a special type of composition. If you expose all the methods of a composite class and route the method call to the composite method through its reference, then it is called aggregation.

Q28. What Is A Hashcode?

hashcode value for this object which is unique for every object.

Q29. What Is The Difference Between Interface And Abstract Class?

Abstract class defined with methods. Interface will declare only the methods. Abstract classes are very much useful when there is a some functionality across various classes. Interfaces are well suited for the classes which varies in functionality but with the same method signatures.

Q30. What Is The Eligibility For A Object To Get Cloned?

It must implement the Cloneable interface