• +91 9723535972
  • info@interviewmaterial.com

J2EE Interview Questions and Answers

J2EE Interview Questions and Answers

Question - 81 : - What Is J2ee?

Answer - 81 : - J2EE is an environment for developing and deploying enterprise applications. The J2EE platform consists of a set of services, application programming interfaces (APIs), and protocols that provide the functionality for developing multitiered, web-based applications.

Question - 82 : - What factors should a J2EE application possess for operating in a global economy?

Answer - 82 : -

Following are the factors that a J2EE application should possess to operate globally:

  • Financial Considerations: Each country has its taxes, restrictions and tariffs depending on the government. All these factors should be considered while developing the J2EE application.
  • Language Requirements: An application developed should support regional languages of the country for wider user coverage.
  • Legal Differences: Every government has their custom laws, privacy laws and requirements for each country. An application developed should abide by all the rules of the land.

Question - 83 : - What are the design goals of J2EE architecture?

Answer - 83 : -

The design goals of J2EE architecture are as follows:

  • Service Availability: To ensure that the application is available 24*7 to achieve required business goals.
  • Data Connectivity: The connection between a J2EE application and legacy systems should remain compatible enough for ensuring business functions.
  • Ease of Accessibility: The user should be able to connect to applications using any device and from anywhere.
  • User Interaction: The user interaction should be seamless and should be able to connect to different devices like desktops, mobiles, laptops etc.
  • Abstraction and Flexibility: The developer should focus on business logic and the configuration details should be handled by the server.

Question - 84 : - What do you understand by Connectors? Can you describe the Connector Architecture?

Answer - 84 : -

Connectors are used for providing standard extension mechanisms to provide connectivity to different enterprise information systems. A connector architecture consists of resource adapters and system-level contracts, both of which are specific to enterprise information systems. The resource adapters are plugged into the container. The connector architecture defines certain contracts which a resource adapter must support for plugging into J2EE applications like security, transaction, resource management etc.

Question - 85 : - What do you understand by JRMP?

Answer - 85 : -

JRMP stands for Java Remote Method Protocol which is used for Remote Method Invocation (RMI) for passing Java objects as arguments. It is an underlying protocol used by RMI for marshalling objects as a stream during object serialization for transferring objects from one JVM to other.

Question - 86 : - What happens if the database connected to the Java application via connection pool suddenly goes down?

Answer - 86 : -

Since the Java application uses a connection pool, it has active connections that would get disconnected if the database goes down. When the queries are executed to retrieve or modify data, then we will get a Socket exception.

Question - 87 : - How is 32-bit JVM different from 64-bit JVM?

Answer - 87 : -

64-bit JVM is used in 64-bit operating systems whereas 32-bit JVM is used for 32-bit operating systems. In 64-bit JVM, we can specify more heap size memory up to 100G when compared to the 4G limit of 32-bit JVM. Java applications take more memory while running in 64-bit JVM when compared to running the same application in 32-bit JVM. This is because of the increased size of the Ordinary Object Pointer. However, this can be bypassed by making use of the -XXCompressedOOP option of the JVM for telling to use 32-bit pointers. Additionally, 64-bit JVM uses 12 bytes object header size and a maximum of 8 bytes of internal references whereas the 32-bit JVM uses 8 bytes headers and a maximum of 4 bytes of internal references.

Question - 88 : - What is the purpose of heap dumps and how do you analyze a heap dump?

Answer - 88 : -

Heap dumps consist of a snapshot of all live objects on Java heap memory that are used by running Java applications. Detailed information for each object like type, class name, address, size and references to other objects can be obtained in the heap dump. Various tools help in analyzing heap dumps in Java. For instance, JDK itself provides jhat tool for analysing heap dump. Heap dumps are also used for analysing memory leaks which is a phenomenon that occurs when there are objects that are not used by the application anymore and the garbage collection is not able to free that memory as they are still shown as referenced objects. Following are the causes that result in memory leaks:

  • Continuously instantiating objects without releasing them.
  • Unclosed connection objects (such as connections to the database) post the required operation.
  • Static variables holding on to references of objects.
  • Adding objects in HashMap without overriding hashCode() equals() method. If these methods are not included, then the hashmap will continuously grow without ignoring the duplicates.
  • Unbounded caches.
  • Listener methods that are uninvoked.
Due to this, the application keeps consuming more and more memory and eventually this leads to OutOfMemory Errors and can ultimately crash the application. We can make use of the Eclipse Memory Analyzer or jvisualVM tool for analysing heap dump to identify memory leaks.

Question - 89 : - How can we take a heap dump of a Java process?

Answer - 89 : -

There are multiple ways for taking heap dump of Java process. Tools like jCmd, jVisualVM, jmap are available for this purpose. For example, if we are using jmap, then heap dump can be taken by running the below command:

$ jmap -dump:live, file=/path/of/heap_dump.hprof  PID
This heap dump contains live objects that are stored in heap_dump.hprof file. Process ID (PID) of the Java process is needed to get the dump that can be obtained by using ps or grep commands.

Question - 90 : - What are EAR, WAR, and JAR?

Answer - 90 : -

EAR stands for Enterprise Archive file and it consists of web, EJB and client components all compressed and packed into a file called .ear file. EAR files allow us to deploy different modules onto the application server simultaneously.

WAR stands for Web Archive file and consists of all web components packed and compressed in a .war file. This file allows testing and deploying web applications easily in a single request.

JAR stands for Java Archive file. It consists of all libraries and class files that constitute APIs. These are packed and compressed in a file called the .jar file. These are used for deploying the entire application including classes and resources in a single request.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners