Computer Knowledge

Java Enterprise and Web Technologies

2,279 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

Multiple choice technology web technology
  1. currency conversion

  2. web browsers

  3. weather reports

  4. language translation

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Web Services provide functional capabilities like currency conversion, weather reports, and language translation as service components. However, web browsers are client applications, not application components that web services would offer. Web services are consumed BY web browsers, not offered AS web browsers.

Multiple choice technology web technology
  1. Simplified Object Access Protocol

  2. Simplified Object Authenication Protocol

  3. Specified Simple Object Access Protocol

  4. Simple Object Access Protocol

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

SOAP is an acronym for Simple Object Access Protocol, a standardized web‑service protocol. The other alternatives modify or add words that are not part of the official name.

Multiple choice technology architecture
  1. Less code than a BMP entity bean

  2. Faster data access than BMP

  3. Reduced coupling with entity bean

  4. Easier to code than BMP entity bean

Reveal answer Fill a bubble to check yourself
B,C Correct answer
Explanation

DAO pattern provides faster data access than BMP by abstracting persistence logic and optimizing database calls. It reduces coupling by separating data access from business logic in entity beans, making the code more maintainable.

Multiple choice technology web technology
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

JSP pages are translated into Java servlets behind the scenes. The JSP container converts the JSP into Java source code, compiles it into a servlet class, and loads it. This translation and compilation happens only once when the JSP is first requested, making subsequent loads much faster since only the compiled servlet needs to be executed.

Multiple choice technology web technology
  1. Tomcat

  2. Weblogic

  3. Websphere

  4. None of the above

Reveal answer Fill a bubble to check yourself
A,B,C Correct answer
Explanation

JSP pages can be executed on any Java EE compliant application server or servlet container. Apache Tomcat, Oracle WebLogic, and IBM WebSphere are all popular application servers that support JSP execution. These servers provide the JSP container needed to translate, compile, and run JSP pages.

Multiple choice technology web technology
  1. <jsp:error page="errorPage.jsp" guard="true" />

  2. <%@ page language="java" buffer="8k" %>

  3. <jsp:useBean id="bean" class="examples.Bean" scope="request" />

  4. <%@ page language="java" errorPage="errorPage.jsp" buffer="8k" %>

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In JSP 1.0, the errorPage attribute of the page directive designates an error page to handle uncaught exceptions. When the validationGuard method throws an exception, control automatically transfers to errorPage.jsp. Options A and C are syntactically incorrect, and B only sets buffer size without exception handling.

Multiple choice technology web technology
  1. The forward method transfers control to the designated resource, while the include method invokes the designated resource, substitutes its output dynamically in the display, and returns control to the calling page.

  2. The two methods provide the same functionality, but with different levels of persistence.

  3. The forward method is deprecated as of JSP 1.1 and the include method should be used in order to substitute portions of a dynamic display at runtime.

  4. The include method transfers control to a dynamic resource, while the forward method allows for dynamic substitution of another JPS pages output, returning control to the calling resource.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The forward method permanently transfers control to the target resource - the client sees the target's response. The include method temporarily invokes the target, captures its output, inserts it into the current response, then returns control to the calling page. Option B incorrectly claims they differ only in persistence, C incorrectly states forward is deprecated, and D swaps their definitions.

Multiple choice technology web technology
  1. A JSP page

  2. A JavaBean

  3. A servlet

  4. A session manager

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In a page‑centric web architecture the first component that receives the HTTP request is a JSP page, which processes the request directly or includes other resources. Servlets or beans are typically invoked later, making the JSP the initial contact point.

Multiple choice technology web technology
  1. Lookup the EJBs from within a JSP, but use the EJBs from within a basic JavaBean.

  2. Lookup and use the EJBs from a separate business delegate. The JavaBeans that work with JSP pages are clients to these business delegates and know nothing about EJB specifics.

  3. Lookup and use the EJBs from within a JSP page, but only as remote references.

  4. Lookup the EJBs from within a servlet, delegating usage to specific JSP pages.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The business delegate pattern provides a clean separation: JSP pages work with simple JavaBeans, which in turn call business delegates that handle EJB lookup and interaction. This isolates JSP from EJB complexity. Option A incorrectly mixes concerns, C ties JSP directly to EJBs (tight coupling), and D introduces unnecessary servlet indirection.

Multiple choice technology web technology
  1. Code that deals with logic that is common across requests.

  2. Code that deals with logic that is vendor specific.

  3. Code that deals with logic that relates to database access.

  4. Code that deals with logic that relates to client scope.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Code that implements logic common across multiple requests (shared business logic, validation, data processing) should be factored into servlets for reusability and maintainability. Vendor-specific logic belongs in specialized adapter layers, not general servlets. Database and client-scope logic have specific factoring patterns not directly related to request-commonality.

Multiple choice technology web technology
  1. Moving the code into your session manager.

  2. Moving the code into scriptlets.

  3. Moving the code into JavaBeans and servlets.

  4. Moving the code into a transaction manager.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

JavaBeans and servlets are the standard alternatives to embedding Java code in JSP. JavaBeans encapsulate business logic and data, while servlets handle request processing and control flow. This promotes separation of concerns and maintainability. Session managers and transaction managers serve different purposes (state/transactions), not code organization.

Multiple choice technology web technology
  1. Redirects are no longer supported in the current servlet API.

  2. Redirects are not a cross-platform portable mechanism.

  3. The RequestDispatcher does not use the reflection API.

  4. The RequestDispatcher does not require a round trip to the client, and thus is more efficient and allows the server to maintain request state.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

RequestDispatcher forwards a request internally on the server, keeping the original request and response objects intact, which avoids an extra client‑server round‑trip. A sendRedirect instructs the browser to issue a new request, losing request attributes and adding latency. Therefore forwarding is more efficient and preserves server‑side state.

Multiple choice technology web technology
  1. It allows the JSP to access middleware.

  2. It creates a cleaner role separation between the web-production team and the software development team, so that the web-production team can focus on presentation markup, while the software team can focus on building reusable software components for helpin

  3. It provides a dynamic markup environment, such that JavaBeans are integrated seamlessly with the template presentation content, in order to create the dynamic display for the client.

  4. It provides the developer with full access to the Java 2 Platform Enterprise Edition (J2EE), which is unavailable from outside the JavaBean environment.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Using JavaBeans creates clear role separation: web production teams focus on HTML/presentation markup, while software development teams build reusable Java components. This parallel workflow improves productivity. Options A and C incorrectly describe technical benefits rather than team workflow, and D incorrectly claims J2EE access is exclusive to JavaBeans.

Multiple choice technology web technology
  1. Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime usage.

  2. JSP and servlets are unrelated technologies.

  3. Servlets and JSP are competing technologies for handling web requests. Servlets are being superseded by JSP, which is preferred. The two technologies are not useful in combination.

  4. JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usage.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

To answer this question, the user needs to have a basic understanding of JSP and servlets.

Option A is incorrect. Servlets and JSPs are separate technologies and are not compiled to each other.

Option B is incorrect. JSP and servlets are related technologies used for web development.

Option C is incorrect. Servlets and JSPs are complementary technologies that can be used together to handle web requests.

Option D is correct. JSPs are built on top of the Servlet API and are ultimately compiled down to servlets.

Therefore, the correct answer is:

The Answer is: D

Multiple choice technology programming languages
  1. java.nio

  2. java.text

  3. java.xml

  4. java.io

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

java.xml is not a standard Java API package in the same sense as the others. The java.nio, java.text, and java.io packages are core Java APIs that have been part of the standard edition since early versions. java.xml typically refers to XML processing libraries which are often in javax.xml or separate packages, not a core java.* API.