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

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 web technology
  1. File System

  2. Local IIS

  3. FTP Site

  4. Remote Site

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

The FTP Site location option in Visual Studio enables direct deployment to remote web servers via FTP. This allows you to create and modify ASP.NET applications on a remote server as if working locally, with changes synchronized automatically through the FTP connection.

Multiple choice technology web technology
  1. Application_Start

  2. Session_Start

  3. Application_BeginRequest

  4. Session_OnBegin

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

Session_Start fires when a new user session begins, which happens on the first request from a user. Application_Start runs once when the application starts (not per user), Application_BeginRequest fires on every request, and Session_OnBegin is not a valid event name - the correct syntax is Session_Start.

Multiple choice technology
  1. _execute()

  2. MMExecute()

  3. Both of the above

  4. None of the above

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

MMExecute() is the specific ActionScript function that allows executing Flash JavaScript API (JSAPI) commands from within ActionScript. This enables communication between ActionScript and the Flash authoring environment or Flash Player. The other functions listed (_execute() and the options) are not standard ActionScript/Flash JSAPI functions.

Multiple choice technology programming languages
  1. A bean cannot use java.net.Socket.

  2. A bean instance variable cannot be declared static and final.

  3. A bean cannot listen on a socket as a server.

  4. A bean cannot use the java.io package.

  5. A bean cannot use this in the body of a class method.

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

EJB 2.0 spec restricts beans to managed container environments: they cannot act as socket servers (C) because the container manages all network resources, and cannot use java.io (D) to prevent direct file system access. Option A is false - beans can use Sockets (as clients), and B is false - instance variables can be static/final.