Computer Knowledge
Java Enterprise and Web Technologies
2,183 Questions
Java enterprise and web technologies questions focus on J2EE architecture, web services like SOAP, and servlet functionalities. These topics frequently appear in IT officer and specialist scale examinations. Regular practice ensures familiarity with enterprise application components.
HttpServlet methodsSOAP and web servicesEJB architecture rolesJ2EE componentsJSP servlet callingUDDI concepts
Java Enterprise and Web Technologies Questions
B
Correct answer
Explanation
EJB components require an EJB container (like JBoss, WebLogic) to run - they're not standalone. JavaBeans are plain Java classes and are portable, but the statement lumps them together incorrectly.
-
getServletContext().getRequestDispatcher("/DateDisplay.jsp").forward(HttpServletRequest,HttpServletResponse);
-
sendPage("TestDisplay", HttpServletRequest,HttpServletResponse)
-
callPage("TestDisplay", HttpServletRequest,HttpServletResponse)
-
HttpServletResponse.sendRedirect("/TestDisplay.jsp")
-
page , request , out , application
-
request , response , session , out
-
page , request , session , application
-
request , response , session , application
C
Correct answer
Explanation
The jsp:useBean action defines four valid scope values: page (default), request, session, and application. The 'out' scope does not exist in JSP - 'out' is an implicit object for writing to the JSPWriter, not a bean scope. Similarly, 'response' is not a valid scope value.
-
Connection Management
-
Bean Management
-
Transaction Management
-
Object relational mapping
-
Relational Management
A,C,D
Correct answer
Explanation
Hibernate's three main architectural components are Connection Management (handles database connections), Transaction Management (manages ACID transactions and ensures data consistency), and Object Relational Mapping (maps Java objects to database tables). These form the core framework for database interaction. Bean Management and Relational Management are not standard Hibernate architectural components - the framework uses POJOs (Plain Old Java Objects) rather than managing beans directly.
-
To create the connection pool and setup required environment
-
To configure bean management setup environment
-
To talk to the database directly with out this configuration file
-
To create an object and map the data with corresponding object
A
Correct answer
Explanation
The hibernate.cfg.xml configuration file's primary purpose is to set up the Hibernate environment - database connection parameters (driver class, URL, credentials), dialect, connection pool settings, and other runtime configurations. Option B refers to Spring bean management, Option C is incorrect (you need this file), and Option D describes mapping, not configuration.
-
Session
-
ApplicationContext
-
SessionFactory
-
Hibernate Object
C
Correct answer
Explanation
The SessionFactory is responsible for creating Session instances. It reads the configuration from hibernate.cfg.xml during initialization and provides a thread-safe factory for creating Sessions. The Session itself is created by SessionFactory, not the other way around. ApplicationContext is a Spring concept.
-
SessionFactory sessionFactory = new Configuration().configure();
-
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
-
SessionFactory sessionFactory = new Configuration().configure().sessionFactory();
-
SessionFactory sessionFactory = new Configuration().buildSession();
B
Correct answer
Explanation
The correct Hibernate API to create a SessionFactory is: new Configuration().configure().buildSessionFactory(). The configure() method reads hibernate.cfg.xml, and buildSessionFactory() constructs the SessionFactory. Option A is incomplete (no buildSessionFactory), Option C has a wrong method name, and Option D is incorrect.
-
Perform Object Java Oriented
-
Plain Object Java Old
-
Platform Oriented Java Object
-
Plain Old Java Object
D
Correct answer
Explanation
Hibernate works best with POJOs, which stands for Plain Old Java Objects. This programming model emphasizes simple, lightweight Java classes that do not inherit from framework-specific classes or implement restrictive interfaces.
-
Connection Management
-
Bean Management
-
Transaction Management
-
Object relational mapping
-
Relational Management
A,C,D
Correct answer
Explanation
Hibernate's core architecture comprises Connection Management (database connectivity), Transaction Management (ACID transaction handling), and Object Relational Mapping (mapping Java objects to database tables). Bean Management is a Spring/EJB concept, not part of Hibernate.
-
Stateless event driven
-
Streaming API Driven
-
Static binding of XSD to Java components
-
All the above
C
Correct answer
Explanation
JAXB uses static binding of XSD to Java components, meaning Java classes are generated at compile time from the schema. This differs from SAX (stateless event-driven) and StAX (streaming API) which are dynamic parsers.
-
The Content tree is specific to schema
-
Content tree is not created dynamically
-
As there is no extra tree manipulation functionality
-
As it allows data access through accessor methods
B
Correct answer
Explanation
JAXB uses memory efficiently because the content tree is not created dynamically - it's generated at compile time from the schema, avoiding runtime overhead. Schema-specific trees (A) and accessor methods (D) don't directly explain efficiency.
-
Server in java.net package
-
ServerSocket in java.util.package
-
Server in java.util package
-
ServerSocket in java.net package
D
Correct answer
Explanation
ServerSocket is the correct class for implementing TCP servers in Java, and it is located in the java.net package, not java.util. Option B incorrectly places ServerSocket in java.util, while options A and C reference a non-existent 'Server' class.
-
Can be used to generate server side and client side Java (Web Service) code from a WSDL
-
Can be used to generate a WSDL from Java (Web Service) code
-
Both A and B
-
one of the above
C
Correct answer
Explanation
JAX-RPC supports round-trip development in both directions: it can generate Java stubs (server and client) from WSDL (top-down approach) and generate WSDL from Java interfaces (bottom-up approach). This bidirectional capability is captured in option C. Both A and B individually are incomplete.
-
A new XML parser implementation
-
A standard XML API that can be used by developers with over an XML parser
-
A standard XML parsing technique
-
none of the above
B
Correct answer
Explanation
JAXP is a standard Java API that provides a pluggable abstraction layer over different XML parser implementations (like DOM and SAX parsers from various vendors). It does not implement parsing itself but standardizes how developers interact with parsers. Option B correctly describes this abstraction, despite minor phrasing issues.
A
Correct answer
Explanation
JAX-RPC implements standard web service specifications (SOAP, WSDL, XML Schema) that ensure cross-platform interoperability. Java web services built with JAX-RPC can consume .NET services and vice versa because both adhere to WS-I standards. This interoperability is a fundamental design goal of web services.