Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What are the differences between JVM vs JIT vs JDK vs JRE?

Answer»
JVMJITJDKJRE
Java Virtual Machine: Introduced for MANAGING system memory and also to provide a PORTABLE execution environment for Java applications.Just in Time Compilation: This is a part of JVM and was developed for improving JVM performance. Java Development Kit: JDK is a cross-platformed software development environment offering various collections of libraries and TOOLS required for developing Java applications and applets.Java Runtime Environment: JRE is part of JDK that consists of JVM, core classes and support libraries. It is used for providing a runtime environment for running Java programs.
Used for compiling byte code to machine code completely.This is used for compiling only reusable byte code to machine code.JDK is essential for writing and running programs in Java.JRE is a subset of JDK and is like a container that consists of JVM, supporting libraries and other files. It doesn't have development tools such as compilers and debuggers.
This is used for providing platform independence.This is used for improving the performance of JVM.JDK is used for developing Java programs as it provides libraries and compiler tools as well as JRE for running the code.JRE is not suitable for development. It is used for running Java Programs as it provides runtime environments and tools for supporting execution.
2.

What factors should a J2EE application possess for operating in a global economy?

Answer»

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.
3.

What do you understand by JSF?

Answer»

JSF stands for Java SERVER Faces which is a web framework that is INTENDED for simplifying the development process for user interfaces. It is a STANDARDIZED display technology for Java-based web applications. It is based on MVC (Model-View-Controller) pattern and provides reusable UI components.

4.

What constitutes web components?

Answer»

Java Servlets and Java Server Pages (JSP) components together constitute web components.

Java Servlets dynamically process requests and responses. JSP pages are USED for EXECUTING servlets that ALLOW a natural approach to creating static CONTENT.

5.

What do you understand by ORM?

Answer»

ORM stands for Object-Relational Mapping that transforms objects of Java class to tables in relational databases and vice versa using metadata describing the mapping between the database and the objects. 

This is represented as shown in the below image:

Consider an example where we have an Employee class having employeeId, firstName, lastName, contactNo as attributes. Consider we also have an Employee table that has ID, FNAME, LNAME and CONTACT_NO as COLUMNS. If we want to send DATA from our Java application and save it in the database, we cannot do it straightforwardly by simply saving the Java objects in the database directly. We need some SORT of a mapper that maps the Java objects to the records that are compatible to be saved in the database table. This is where ORM comes into the picture. ORM helps in this transformation while writing data to the database as described in the below image:

The database records cannot be directly CONSUMED by the Java applications as Java only deals with objects. ORM again plays a major role in the transformation of database records to Java objects.

6.

What is the architecture model of Struts?

Answer»

Strut is a combination of JSP, Java Servlets, MESSAGES and CUSTOM tags that together form an application development framework for developing enterprise-level applications. It is based on MVC (Model-View-Controller) architecture.

  • Model: This component defines the INTERNAL system state. It can either be a Java Beans cluster or a single bean depending on the application architecture.
  • View: Struts MAKE use of JSP technology for designing views of enterprise-level applications.
  • Controller: It is a servlet and is used for managing user actions that process requests and RESPOND to them.
7.

What are the J2EE applets? Why can we use it?

Answer»

Applets are J2EE client components that are written in JAVA and are EXECUTED in a web browser or a VARIETY of other devices which supports the applet programming model. They are used for providing interactive features to web apps and help in providing small, PORTABLE embedded Java programs in HTML pages which will be run AUTOMATICALLY when we view the pages.

8.

What is an EJB? How can you use it in J2EE?

Answer»

EJB or Enterprise Java Beans is one of the most important parts of the J2EE platform that helps to develop enterprise-level multi-tiered applications and deploy them by keeping in mind performance, scalability and robustness. EJBs can be used when we want to achieve the following:

  • Clustering: For deploying the application in a CLUSTER environment, EJBs can be used to achieve high availability and FAULT tolerance.
  • Concurrency without using Threads: EJBs can be used to achieve concurrency without using actual threads since they are instantiated using the object pool and are available in the EJB container. This helps in achieving performance without involving complexities around Threads.
  • Transaction management: EJBs can be used for achieving transaction management for databases by using annotations provided by EJB.
  • Database CONNECTION Pool: EJB can access connection pools defined in the J2EE server. The connection pools help in achieving abstraction of database connectivity and operations.
  • Security: EJBs use JAAS (Java Authentication and Authorization SERVICE) to develop secure applications. EJB methods can be authenticated and AUTHORISED with only configuration changes.
  • Scheduler Service: EJBs can be used in the Timer Service which enables task implementation for further execution or repetitive execution.
9.

Why do we have JDBC and JNDI in J2EE? How are they different from each other?

Answer»

JDBC or Java DATABASE Connectivity PROVIDES guidelines and APIs for connecting databases from different vendors like MySQL, Oracle, PostgreSQL etc for GETTING data. JNDI (Java Naming and DIRECTORY Interface) helps in providing logical structure to retrieve a resource from the database, EJB beans, messaging queues etc without knowing the actual host address or port. A resource can be registered with JNDI and then those registered application components can be accessed using the JNDI NAME.

10.

What do you understand by build file?

Answer»

A build FILE is used for automating VARIOUS steps involved in software development. ALONG with this, the build file also specifies libraries and their versions that need to be included. It also includes the TYPE of optimizations required for the project. Whenever the project size increases, build provides a STANDARD way to build the project.

11.

How is multi-tier client-server architectural model advantageous?

Answer»

Multi-tier client-server architectural model CONSISTS of various components KNOWN as tiers that interact with each other. The below image represents the three-tier application model which has client/presentation tier, business logic tier and the database tier which interact with each other to process a request and send a response:

In the multi-tier system, we have the following advantages:

  • Any changes to the user interface or business logic can be DONE independently.
  • It introduces abstraction between the components. For example, the client tier can access data without knowing from where and how the response comes from, what is the server infrastructure available in the BACKEND etc.
  • Each tier can be coded or developed independently. For example, the middle tier can be coded in Java or python, the client tier can be coded in Angular or REACT etc.
  • The database can have pooled connections for sharing data among multiple users without the need for creating a new connection for every user.
12.

How are PATH and CLASSPATH different from each other in terms of J2EE?

Answer»

PATH and CLASSPATH are key environmental variables used by Java platforms.

  • The PATH VARIABLE points to JDK binaries or native libraries like java.exe. Whereas The CLASSPATH variable points to the binaries of Java such as JAR files that CONSIST of bytecode.
  • PATH is a system-level variable independent of Java being PRESENT in the system or not. Whereas CLASSPATH is purely Java-specific which is used by JVM for loading CLASSES required by Java applications while running.
13.

How is JDK different from JIT?

Answer»

JDK (Java Development Kit) is a cross-platformed software development environment offering various collections of LIBRARIES and tools required for developing Java applications and applets. It also consists of JRE that provides tools and libraries which aids in byte code execution. JDK is needed for writing and running programs in Java. Whereas JIT STANDS for Just In Time Compiler which is a module inside JVM (which is inside JRE). JIT compiler is USED for compiling some parts of byte code having similar functionality at the same time to machine code for optimising the compilation time and performance.

14.

What are the various components of J2EE application architecture?

Answer»

J2EE is made up of 3 main components (tiers) - Client tier, Middle tier, ENTERPRISE data tier as shown in the below image:

  • Client Tier: This tier has programs and applications which interact with the user and they are generally located in different machines from the server. Here, different inputs are taken from the user and these requests are forwarded to the server for PROCESSING and the response will be sent back to the client.
  • Middle Tier: This tier comprises of Web components and EJB containers. The web components are either servlet or JSP pages that process the request and generate the response. At the time of the application’s assembly, the client’s static HTML codes, programs and applets along with the server’s components are bundled within the web components. The EJB components are present for processing inputs from the user which are sent to the Enterprise Bean that is running in the BUSINESS tier.
  • Enterprise Data Tier: This tier includes database servers, resource planning systems and various other data sources that are located on a separate machine which are accessed by different components by the business tier. Technologies like JPA, JDBC, Java transaction API, Java Connector Architecture etc are used in this tier.
15.

What are some of the technologies provided by the J2EE platform?

Answer»

Some of the important technologies provided by J2EE are:

  • Java API for XML-Based RPC (JAX-RPC): This is used to build web services and clients that make use of XML and Remote Procedure Calls.
  • Java Server Pages (JSP): This is used for delivering XML and HTML documents. Apart from these, we can make use of OutputStream for delivering other data types as well.
  • Java Servlets: Servlets are classes used for extending the server capabilities which hosts applications and can be accessed using the request-response model.
  • Enterprise Java Beans (EJB): This is a server-side component that is used for encapsulating the application’s business logic by providing runtime environment, security, servlet LIFECYCLE management, transaction management and other services.
  • J2EE Connector ARCHITECTURE: This defines standard architecture to CONNECT J2EE platforms to different EIS (Enterprise Information Systems) such as mainframe processes, database systems and different legacy applications coded in another language.
  • J2EE Deployment API: Provides specifications for web services deployment
  • Java Management Extensions (JMX): They are used for supplying tools for monitoring and managing applications, objects, devices and networks.
  • J2EE Authorization Contract for Containers (JACC): This is used to define security contracts between authorization policy modules and application servers.
  • Java API for XML Registries (JAXR): This provides standard API to access different XML Registries to enable infrastructure for the building and deployment of web services.
  • Java Message Service (JMS): This is a messaging standard for allowing different JEE components for creating, SENDING, receiving and reading messages by enabling communication in a distributed, loosely coupled, asynchronous and reliable manner.
  • Java Naming and Directory Interface (JNDI): This is an API that provides naming and directory functionality for Java-based applications.
  • Java Transaction API (JTA): This is used for specifying Java standard interfaces between transaction systems and managers.
  • Common Object Request Broker Architecture (CORBA): This provides a standard for defining Object Management Group designed for facilitating system communication deployed on diverse platforms.
  • JDBC data access API: This provides API for getting data from any data sources like flat files, spreadsheets, relational databases etc.
16.

What are the main advantages of J2EE?

Answer»

Following are the advantages of the J2EE platform:

  • Support for Web Services: J2EE provides a platform to develop and deploy web services. The JAX-RPC (Java API for XML based Remote Procedure Call) HELPS developers develop SOAP-based portable and interoperable web services, clients and endpoints.
  • Faster Time to Market: J2EE uses the CONCEPT of containers for simplifying the development. This helps in business logic separation from lifecycle management and resources which aids developers to focus on business logic than on the infrastructure. For instance, the EJB (Enterprise JavaBeans) container takes CARE of threading, distributed communication, transaction management, SCALING etc and provides a necessary abstraction to the developers.
  • Compatibility: J2EE platform follows the principle of “Write Once, Run Anywhere”. It provides comprehensive standards and APIs that ensures compatibility among different application vendors resulting in the portability of applications.
  • Simplified connectivity: J2EE helps in easier applications connectivity which allows utilizing the capabilities of different devices. It also provides JMS (Java Message Service) to integrate diverse applications in asynchronous and loosely coupled ways. It also provides CORBA (Common Object Request Broker Architecture) support for linking systems tightly via remote calls.

Due to all the above benefits packed in one technology, it helps the developers to reduce the TCO (Total Cost of Ownership) and also focus more on actual business logic IMPLEMENTATION.

17.

What is J2EE?

Answer»

J2EE or Java Enterprise Edition is a Java-based PLATFORM that is a combination of services protocols and APIS (Application Programming Interfaces) that provides capabilities to develop multi-tier, SECURE, stable and FAST enterprise-level applications. J2EE provides web, enterprise, web service and VARIOUS other specifications for developing enterprise-level web applications.