Capgemini previously asked technical questions with answers.Capgemini previous years placement papers questions Capgmini technical and hr interview procedure Capgemini question bank Here a list of Technical java questions answers asked in different placement drives
Capgemini new placement papers questions of Technical Java
1. Tell me about yourself ?
2. Explain about your current project ?
3. How many types of literals are there in JAVA ?
There are four types of literals they are Integer literals, Floating point literals, Boolean literals and character literals.
4. What is meant by Garbage collection ?
The technique that automatically destroys the dynamically created objects is called garbage collection. When no reference to an object exists, that object is assumed to be no longer needed, and memory occupied by that object can be reclaimed.
5. Diffference btw string s= new string (); and string s = "abv"; ?
6. What is singleton class? where is it used ?
Singleton is a design pattern meant to provide one and only one instance of an object. Other objects can get a reference to this instance through a static method (class constructor is kept private). Why do we need one? Sometimes it is necessary, and often sufficient, to create a single instance of a given class. This has advantages in memory management, and for Java, in garbage collection. Moreover, restricting the number of instances may be necessary or desirable for technological or business reasons-for example, we may only want a single instance of a pool of database connections.
7. What is the difference between JSP and Servlets ?
JSP is used mainly for presentation only. A JSP can only be HttpServlet that means the only supported protocol in JSP is HTTP. But a servlet can support any protocol like HTTP, FTP, SMTP etc.
8. What is the difference in using request.getRequestDispatcher() and context.getRequestDispatcher()?
In request.getRequestDispatcher(path) in order to create it we need to give the relative path of the resource. But in resourcecontext.getRequestDispatcher(path) in order to create it we need to give the absolute path of the resource.
9. How the JSP file will be executed on the Server side ?
The JSP file is a document contains tags containing Java Code and this document looks like HTML document. This document saved with some name and ended with the extension of .jsp. This document can be copied in to Document Root of the Web Application at the Server side.
The first time the file (*.jsp) is requested, it is compiled into Servlet object and stored in the Server Memory, and the out put is sent back to the requesting Client.
After the first request the from second request onwards Server checks to see whether the *.jsp file has changed. If it has not changed then the Server invokes the previously compiled Servlet object. The JSP ultimately converted into a Servlet object and remains in the Server Memory and managed at Server side like how the manually developed Servlets managed by the Server.
10. What is ActionServlet ?
The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the server goes through the controller. Controller is responsible for handling all the requests.
11. What is Struts Validator Framework ?
Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser. Server side validation of form can be accomplished by sub classing your From Bean with DynaValidatorForm class.
12. What is the difference between the Session and SessionFactory in hibernate ?
Session Interface: This is the primary interface used by hibernate applications. The instances of this interface are lightweight and are inexpensive to create and destroy. Hibernate sessions are not thread safe.
SessionFactory Interface: This is a factory that delivers the session objects to hibernate application. Generally there will be a single SessionFactory for the whole application and it will be shared among all the application threads.
13. What is HQL ?
HQL stands for Hibernate Query Language. Hibernate allows the user to express queries in its own portable SQL extension and this is called as HQL. It also allows the user to express in native SQL.
JSP is used mainly for presentation only. A JSP can only be HttpServlet that means the only supported protocol in JSP is HTTP. But a servlet can support any protocol like HTTP, FTP, SMTP etc.