Technicalsymposium.com - New Updates Alerts-Subscribe
Our Telegram Channel - Join Us
Our Whatsapp Group - Join Us
Technical Interview Materials PDF-Free Download
Technical Interview Q & A PDF
37) What are different modules in spring?
There are seven core modules in spring
• The Core container module
• O/R mapping module (Object/Relational)
• DAO module
• Application context module
• Aspect Oriented Programming
• Web module
• MVC module
39) What is Spring?
Spring is a lightweight open source framework for the development of enterprise application that resolves the complexity of enterprise application development is also providing a cohesive framework for J2EE application development which is primarily based on IOC (inversion of control) or DI (dependency injection) design pattern.
40) What is the functionality of ActionServlet and RequestProcessor?
• Receiving the HttpServletRequest
• Populating JavaBean from the request parameters
• Displaying response on the web page Issues
• Content type issues handling
• Provide extension points
41) ActionServlet, RequestProcessor, and Action classes are the components of Controller
42) What is default scope in Spring?
43) What are advantages of Spring usage?
• Pojo based programming enables reuse component.
• Improve productivity and subsequently reduce development cost.
• Dependency Injection can be used to improve testability.
• Spring required enterprise services without a need for the expensive application server
. • It reduces coupling in code and improves maintainability.
44)What are the Benefits Spring Framework?
• Lightweight container
• Spring can effectively organize your middle tier objects
• Initialization of properties is easy. No need to read from a properties file
• application code is much easier to unit test
• Objects are created Lazily, Singleton – configuration
• Spring’s configuration management services can be used in any architectural layer, in whatever runtime environment
46) How to Create Object without using the keyword “new” in java?
Without new, the Factory methods are used to create objects for a class. For example
Here Calender is a class, and the method getInstance() is a Factory method which can create an object for Calendar class.
47) What is a servlet?
Servlets is a server-side component that provides a powerful mechanism for developing server side programs. Servlets is a server, as well as platform-independent and Servlets, are designed for various protocols. Most commonly used HTTP protocols. Servlets use the classes in the java packages javax.servlet, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.http.HttpSession;. All servlets must implement the Servlet interface, which defines life-cycle methods.
48) Servlet is pure java object or not?
Yes, pure java object.
49) What are the phases of the servlet life cycle?
The life cycle of a servlet consists of the following phases:
• Servlet class loading
• Servlet instantiation
• the init method
• Request handling (call the service method)
• Removal from service (call the destroy method)
50) What must be implemented by all Servlets?
The Servlet Interface must be implemented by all servlets
1) How do you check your Java process is running on Linux?
You can check by using "ps" command and "grep" command e.g. ps -ef | grep "myprocess". The keyword which you use with grep for search can be anything unique to your process, something which appears in its command line e.g. name of the class which implements the main method. You can also do "ps -ef | grep java" to list all Java process.
2) How do you check how much memory and CPU your Java process is consuming?
First, you need to find the PID of your process, which you can find by using the "ps" command as shown in the previous question. Once you find the PID you can use the "top" command to find the CPU and memory usage.
3) What does -Xmx and -Xms parameters mean?
These are parameters to specify heap size in Java. The -Xms defines the size of the heap when JVM starts up and -Xmx is used to specify the maximum heap size for Java application i.e. your heap cannot grow beyond that and JVM will die by throwing OutOfMemoryError if your heap doesn't have enough space to create new objects.
4) What is the difference between JVM and JRE?
The JRE stands for Java Runtime Environment and JVM stands for Java Virtual Machine. You install JRE to run Java application e.g. Applet or Core Java application or Web server like Tomcat.
5) What is the difference between JVM and JIT? The JVM stands for Java Virtual machine while JIT stands for Just in time Compiler. The JIT is part of JVM and used to convert the Java bytecode into native machine code which runs faster. There is some threshold set if a code runs more than the threshold it becomes the candidate of just in time compilation by JIT. 6) How do you take the heap dump of a Java process?
There are many ways to take the heap dump of a Java process e.g. Tomcat, but most common is by using tools available in JDK e.g. jVisualVM, jCmd, and jmap. Here is the command you can use to take the heap dump of Java process:
$ jmap -dump:live, file=/location/of/heap_dump.hprof PID
The heap dump will contain all live objects and they are stored in heap_dump.hprof file. Remember, you also need PID of Java process which you can find by using "ps" and "grep" command as discussed in the first question.
7) How do you take a thread dump of a Java process?
Taking thread dump is easier than taking heap dump because you don't need to remember tool. In Linux, you can just use the kill command to take the thread dump e.g.
$ kill -3 PID
will print the thread dump in the log file or where System.out is redirected. Similarly, in Windows, you can use Ctrl + Break from the command prompt. Alternatively, you can also use jConsole and VisualVM to take the thread dump of Java application in both Windows and Linux.
8) What is OutOfMemoryError in Java? How do you deal with that?
The Java virtual machine throws java.lang.OutOfMemoryError when there is not enough memory to run the application e.g. no more memory to create new objects, no more memory to create new threads etc.
9) What is the difference between 32-bit and 64-bit JVM? (answer)
The main differences between 32-bit and 64-bit JVM are that later is designed for 64-bit operating system e.g. Windows 8 or later versions of Linux. From Java developer's perspective, the main difference between them comes from heap size. A 64-bit JVM virtually has unlimited heap memory as compared to 4GB of the theoretical limit of 32-bit JVM. If your program needs more memory, better run it on 64-bit JVM with large heap space. See here to learn more about 32-bit and 64-bit JVM.
13) What is Garbage Collector?
The garbage collector is a component of Java virtual machine which is responsible for reclaiming memory from dead objects. It's one of the key components and allows an application developer to focus on application development rather than doing memory management. Some of the popular garbage collectors are a Concurrent Mark-Sweep garbage collector and G1 garbage collector in recent times.
Source: Contents are provided by Technicalsymposium Google Group Members.
Disclaimer: All the above contents are provided by technicalsymposium.com Google Group members.
Further, this content is not intended to be used for commercial purpose. Technicalsymposium.com is not liable/responsible for any copyright issues.
Technicalsymposium.com-All Quick Links & Study Notes PDF- Free Download