J2EE INTERVIEW QUESTIONS W3CODEMASTERS

J2EE INTERVIEW QUESTIONS FOR SENIOR DEVELOPERS 2021

Q1 What are the components of J2EE applications? 

  • Client-tier components. Run on the client machine. 
  • Web tier components. Run on the J2EE server. 
  • Business tier components. Run on the J2EE server. 
  • Enterprise information system software (EIS software).Runs on the EIS server. 

 

Q2 What are the J2EE client types? 

  • Applets 
  • Application clients 
  • Java Web Start enabled clients, by Java Web Start technology. 
  • Wireless clients, based on Mobile Information Device Profile (MIDP) technology. 

 

Q3 What is a J2EE container? 

The interface between a component and the low-level platform with specific functionality that support the component is called a container. The application server maintains control and provides relevant services through an interface or framework calls as a container. 

 

Q4 What are defined as web components? 

Java Servlets and Java server pages technology components are identified as web components. Servlets dynamically receive requests and make responses. JSP server pages also behave as Java Servlets but facilitate to create more static contents. 

 

Q5 Describe the MVC on struts? 

MVC stands for Model View Controller. Each section in Model View Controller can describe as follows. 

  • Model –Model represents the internal state of the system as a set of single or many Java Beans. 
  • View – Most often view is a constructed using Java Server Pages (JSP) technology. 
  • Controller –The controller is the process that focuses on client request receiving and produce next level of a user interface according to the request. The primary component of the controller in the framework is ActionServlet servlet class. 

 

Q6 Define JSF? 

JSF stands for Java Server Faces. It is the user interface (UI) designing framework for Java Web Applications developments. There are set of reusable UI components associated with JSF. Also, JSF based on Model-View-Controller (MVC) design concepts and patterns. The automated data saving process from form to server and display at client side is also handling by JSF. 

 

Q7 What is Hashtable? 

Hash table is a Collection Synchronized objects. It allows Null values but not duplicate values. Hash table is like a HashMap. 

 

Q8 Define Hibernate? 

Hibernate is an open source object-relational mapping and query service which facilitate to write Hibernate Query Language (HQL) scripts instead of Structured Query Language (SQL) scripts. It is faster and easy than writing native SQL. Hibernate has more powerful object oriented contents like associations, inheritance, and polymorphism. Also, Hibernate has a powerful composition and collections. Hibernate allows making queries using Java base approach. 

 

Q9 What are the identified limitation of hibernate? 

  • Slower in action – In execution of HQL queries take more time than it executes directly. 
  • Only composite keys support available and it prevents advanced query options. 
  • No shared value type references available. 

 

Q10 What the identified advantages are of hibernate? 

  • Database and vendor independence application. 
  • Standard Object-relational mapping support. 
  • Domain object mapping for a relational database. 
  • Better performance than Java Database Connectivity. 
  • Java Persistence API based applications. 

 

Q11 Difference between save and saveorupdate 

save() – This method in Hibernate is used to stores an object in the database. It inserts an entry if the record doesn’t exist, otherwise not. 

saveorupdate () -This method in the hibernate is used for updating the object using identifier. If the identifier is missing this method calls save(). If the identifier exists, it will call update method. 

 

Q12 Difference between load and get method? 

load() can’t find the object from cache or database, an exception is thrown, and the load() method never returns null. 

get() method returns null if the object can’t be found. The load() method may return a proxy instead of a real persistent instance get() never returns a proxy. 

 

Q13 How to invoke a stored procedure in hibernate? 

{ ? = call thisISTheProcedure() } 

 

Q14 What are the benefits of ORM? 

  • Productivity 
  • Maintainability 
  • Performance 
  • Vendor independence 

 

Q15  What are the Core interfaces of Hibernate framework? 

  •  Session Interface 
  • SessionFactory Interface 
  • Configuration Interface 
  • Transaction Interface 
  • Query and Criteria Interface 

 

Q16 What is the file extension used for hibernate mapping file? 

The name of the file should be like this: filename.hbm.xml 

 

Q17 What is the file name of hibernate configuration file? 

The name of the file should be like this: hibernate.cfg.xml 

 

Q18 How to add Hibernate mapping file in hibernate configuration file? 

By <mapping resource=” filename.hbm.xml”/> 

Q19 Define connection pooling? 

Connection pooling is a mechanism reuse the connection which contains the number of already created object connection. So whenever it is necessary for an object, this mechanism is used to get objects without creating it. 

 

Q20 What is the Hibernate proxy? 

An object proxy is just a way to avoid retrieving an object until you need it. Hibernate 2 does not proxy objects by default. 

 

Q21 What is HQL? 

HQL stands for Hibernate Query Language. Hibernate allows to the user to express queries in its portable SQL extension, and this is called as HQL. It also allows the user to express in native SQL. 

 

Q22 What are the Collection types in Hibernate? 

Set, List, Array, Map, Bag are collection type in Hibernate. 

 

Q23  What is a thin client? 

A thin client is a program interface to the application that does not have any operations like the query of databases, execute complex business rules, or connect to legacy applications. 

 

Q24 Differentiate between .ear,  .jar and .war files. 

.jar files: These files are with the .jar extension. The .jar files contain the libraries, resources and accessories files like property files.
.war files: These files are with the .war extension. The .war file contains JSP, HTML, javascript and other files necessary for the development of web applications.
.ear files: The .ear file contains the EJB modules of the application. 

 

Q25 What is the JSP tag? 

In JSP tags can be divided into four different types. 

  • Directives 
  • Declarations 
  • Scriplets 
  • Expressions 

 

Q26 How to access web.xml init parameters from JSP page? 

For example, if you have:
<context-param> <param-name>Id</param-name> <param-value>this is the value</param-value></context-param>
You can access this parameter
Id: <h:outputText value=”#{initParam[‘Id’]}”/> 

 

Q27 Is technical support “Free” as well?
There are resources that are available for free on the Sun Solaris website that may help you resolve your issues without requiring technical support. For example you can ask questions on the forum, search for known issues on the bug data base, review the documentation, or take a look at code samples and applications to help you at no cost. 

Production support is also available for a fee through Sun Service. For more information about Developer Technical Service and Sun Service, 

 

Q28  Are there compatibility tests for the J2EE platform?
Yes. The J2EE Compatibility Test Suite (CTS) is available for the J2EE platform. The J2EE CTS contains over 5,000 tests for J2EE 1.4 and will contain more for later versions. This test suite tests compatibility by performing specific application functions and checking results. For example, to test the JDBC call to insert a row in a database, an EJB component makes a call to insert a row and then a call is made to check that the row was inserted. 

 

Q29 What is the difference between being a J2EE licensee and being J2EE compatible?
A J2EE licensee has signed a commercial distribution license for J2EE. That means the licensee has the compatibility tests and has made a commitment to compatibility. It does not mean the licensees’ products are necessarily compatible yet. Look for the J2EE brand which signifies that the specific branded product has passed the Compatibility Test Suite (CTS) and is compatible. 

 

Q30 What is the relationship of the Apache Tomcat open-source application server to the J2EE SDK?
Tomcat is based on the original implementation of the JavaServer Pages (JSP) and Java Servlet specifications, which was donated by Sun to the Apache Software Foundation in 1999. Sun continues to participate in development of Tomcat at Apache, focusing on keeping Tomcat current with new versions of the specifications coming out of the Java Community Source Process. Sun adapts and integrates the then-current Tomcat source code into new releases of the J2EE SDK. However, since Tomcat evolves rapidly at Apache, there are additional differences between the JSP and Servlet implementations in the J2EE SDK and in Tomcat between J2EE SDK releases. Tomcat source and binary code is governed by the ASF license, which freely allows deployment and redistribution. 

 

Q31 How is the J2EE different from Java EE 5 SDK?
The Java EE 5 SDK provides a complete implementation of the Java EE 5 specification along with extra features to help developers learn about what’s new and improved in the specification. The Java EE 5 SDK includes the Sun Java System Application Server Platform Edition 9, the Java SE platform as its foundation, and various tools to help developers’ prototype Java EE applications and learn about the Java EE platform and technologies. 

 

Q32 What is an EJB Platform?
The Enterprise JavaBeans or EJB platform handles functions such as transaction and state management, multithreading, resource pooling, and simple searches while you concentrate on writing business logic. 

Q33 What is the JavaMail API?
The JavaMail API provides a set of abstract classes that model a mail system. The API provides a platform independent and protocol independent framework to build Java technology based email client applications. 

 

Q34 What are the design goals of J2EE architecture?
T following are the design goals of J2EE architecture:
1) Service Availability: The application should be available 24 * 7. The business depends on the application without the need for customer service representatives
2) Data Connectivity: The application should be able to connect to mainframe systems and other legacy systems to ensure business functions as usual
3) Accessibility: User should be able to connect the application from anywhere and from any electronic devices
4) User Interaction: The user should be able to connect to the application from desktop, laptop, PDA, and mobile
5) Flexibility: The architecture should be created in such a way that the developer just concentrates on the business component model (business logic) and the rest of the services are handled by the server 

 

Q35 What are the roles of J2EE Architect?
The following are the roles of J2EE architect:
a) Visualizing the behavior of the system
b) Creating the system blue print
c) Defining the way how the system elements work together
d) Defining non-functional and functional requirements
e) Integrating non-functional requirements into the functional system 

 

Q36 hat is the difference between architecture and design?
Architecture defines the structural issues, communication protocols, data access, synchronization, and subsystems’ classification. It also defines the architectural design of the component interfaces.
In Design, we define the components to be created for each interface, the inputs, the outputs, algorithms, and data structures. In short, the designers describe each component’s internal details. 

 

Q37 What are the activities performed in Architectural Analysis?
The following activities will be performed in Architectural Analysis:
1) Use case diagram: This is developed to depict the high level system functionality
2) Class Diagram: This is developed to depict the functionality as classes and methods
3) Collaboration Diagram: This is developed to depict how each class talk to each other
4) Sequence Diagram: This is developed to depict the operation sequence 

 

Q38 What are the activities performed in Architectural Design?
The following activities will be performed in Architectural Design:
a) The framework (example: Remote Method Invocation) to be used will be decided
b) The software and hardware requirements are defined
c) The performance parameter and the approach to achieve will be defined
d) Analyze for reusing existing components or technology
e) Define the business logic, security, and performance of the system 

 

Q39 What are the activities performed in the object oriented design?
The following activities will be performed in object oriented design:
1. Decide on how classes interact with packages
2. Create dependency diagrams
3. Create deployment diagrams
4. Decide if the components (software) reside in deployment folder 

 

Q40 What are the responsibilities of application assembler?
The following are the responsibilities of application assembler:
a) Build presentation layer i.e., user interface
b) Specify the requirements of transaction management
c) Set transaction parameters for all the bean’s methods
d) Define security roles and assign permissions
e) Specify wild card character (*) to the methods 

 

Q41 What are the responsibilities of bean deployer?
The following are the responsibilities of bean deployer:
1) Map fields to DB (database) columns and manage persistence
2) Define users, groups, roles, and manage security
3) Use the deployment tools and generate wrapper classes
4) Map user roles and groups
5) Ensure all the deployed bean is assigned a transaction parameter 

 

Q42 What are the roles of third party software in EJB framework?
The third party companies that provide the software can play any of the following three roles:
a) Component Provider: Responsible for developing object modeling, programming, architecture, and business process
b) Container Provider: Responsible for proving the environment during runtime to the server
c) Application Server Provider: Responsible for providing platform to develop distributed applications. It usually contains the container which provides the runtime environment 

 

Q43 Explain MVC architecture.
MVC represents Model View Controller architecture. The activity performed in MVC is explained below:
a) In Model, the developer creates the business logic of the system
b) In View, the developer creates the presentation logic
c) In Controller, the developer receives the request and transfers the response 

 

Q43 Explain EAR, WAR, and JAR.
EAR represents Enterprise Archive file. It contains the components of web, EJB, and client. All the components are packed in a compressed file called .ear file.
WAR represents Web Archive file. It contains all the components related to the web application. All the components are packed in a compressed file called .war file.
JAR represents Java Archive file. It contains all the class files and library files which constitute an API (Application Programming Interface). All the components are packed in a compressed file called .jar file. 

 

Q44 Explain JTA, JNDI, and JMS.
JTA represents Java Transaction API. It is used for coordinating and managing transactions across enterprise information system.
JNDI represents Java Naming Directory Interface. It is used for accessing information from directory services.
JMS represents Java Messaging Service. It is used for receiving and sending messages through messaging systems. 

 

Q45 Explain EDI.
EDI represents Electronic Data Interchange. It is used for exchanging data through Value Added Network (VAN) which acts as the transmission medium.
EDI is expensive to install and requires customization by the exchanging clients. EDI also relies on X12 standards to interchange documents. 

 

Q46 Explain EAI?
EAI represents Enterprise Application Integration. This makes one or more applications as single application and requires data to be transmitted to the appropriate system at the right time.
For example, while integrating sales and account systems, it is necessary for sales to send sales order to accounting to generate invoice. Also, accounting must send an invoice to sales to update data for the sales professionals.
This system handles transaction automatically across application and eliminates human errors. 

 

Q47 What is the intent for supporting XML in Java?
The intent to support XML is to:
a) Ensure Java developers understand XML easier and use XML and XML developers use Java
b) Provide standard for Java to ensure consistent and compatible implementations
c) Ensure java platform can be integrated with high quality 

 

Q48 What are the protocols used for communicating between business tier and user interface?
The following protocols are used for communicating between business tier and user interface:
1. HTTP: It denotes ‘Hyper Text Transfer Protocol’
2. JMS: It denotes ‘Java Messaging Service’
3. RMI: It denotes ‘Remote Method Invocation’
4. CORBA: It denotes ‘Common Object Request Broker Architecture’
5. DCOM: It denotes ‘Distributed Component Object Model’ 

 

Q49 What are the advantages and disadvantages of HTTP protocol?
The following are the advantages of HTTP protocol:
a) Stateless and firewall friendly
b) Easier to load balance and scale HTTP servers
The following are the disadvantages of HTTP protocol
a) Difficult to maintain user sessions
b) Limited communication with JSP and servlets 

 

Q50. Explain JRMP.
JRMP represents Java Remote Method Protocol. This is used by Remote Method Invocation (RMI) to pass java objects as arguments.
Since Java relies on Object Serialization which marshal objects as stream, RMI relies on the protocol JRMP to transfer objects from one JVM (Java Virtual Machine) to another.