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 programming languages
  1. isUserInRole

  2. getUserPrincipal

  3. getCookies

  4. getHeader

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

isUserInRole(String role) is used to check if the authenticated user belongs to a specified security role. The element in the DD maps a role name used in code (like isUserInRole calls) to an actual security role defined in the container. getUserPrincipal() returns the Principal object, getCookies() retrieves cookies, and getHeader() reads HTTP headers - none of these relate to role-based security reference mapping.

Multiple choice technology programming languages
  1. HTTP Basic Authentication

  2. Form Based Authentication

  3. HTTP Digest based Authentication

  4. HTTPS Client Authentication

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

Form-based authentication requires a specific HTML form with action j_security_check, username field j_username, and password field j_password. The container requires this exact HTML structure to handle the authentication process. Basic, Digest, and Client Certificate authentication use HTTP headers or SSL certificates - they don't require application-provided HTML forms with specific action attributes.

Multiple choice technology programming languages
  1. Model -View-Controller

  2. Business Delegate

  3. Transfer Object

  4. Intercepting filter

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

The Transfer Object pattern (also called Value Object) creates a serializable object containing multiple data items that can be sent to the client in a single method call instead of multiple fine-grained calls. This reduces network roundtrips between client and EJB. MVC is about separation of concerns, Business Delegate reduces coupling between presentation tier and business tier, and Intercepting Filter is about request/response preprocessing.

Multiple choice technology programming languages
  1. doGet

  2. doTrace

  3. doOptions

  4. doError

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

HttpServlet provides doGet(), doPost(), doHead(), doPut(), doDelete(), doOptions(), doTrace(), and do methods for other HTTP verbs. These are the standard service methods you override to handle specific HTTP request types. doError() is not a valid HttpServlet method - error handling is done through HttpServletResponse.sendError() or error-page configuration.

Multiple choice technology programming languages
  1. Server

  2. Request

  3. Application

  4. Context

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

The 'application' implicit object in JSP represents the ServletContext and provides access to application-scope attributes. ServletContext is the object that stores application-wide data and attributes accessible across all sessions. 'request' is for request scope, 'server' is not a standard JSP implicit object, and 'context' is not used for this purpose in JSP.

Multiple choice technology programming languages
  1. A GUI bean deployment utility

  2. Transaction support for all bean types

  3. JNDI 1.2 name space

  4. Remote client views for all bean types

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

EJB 2.0 containers must provide transaction management across all bean types to ensure data integrity. JNDI 1.2 namespace support is mandatory for resource lookup and naming services. GUI deployment tools are vendor-specific conveniences, not specification requirements. Remote client views are optional - beans can have local-only interfaces.

Multiple choice technology programming languages
  1. A Portable finder query text

  2. Container managed persistence

  3. Local interfaces for session beans

  4. XML based deployment descriptors

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

EJB 2.0 introduced several major enhancements: EJB QL for portable finder queries (eliminating the need for Finder methods in home interfaces), enhanced container-managed persistence with relationships (CMR), local interfaces to avoid remote call overhead for co-located beans, and standardized XML deployment descriptors. Local interfaces apply to both session and entity beans, improving performance for in-process calls.

Multiple choice technology programming languages
  1. Relationships can be one-to-one, one-to-many or many-to-many

  2. A get method return type can use java.util.map

  3. A remote interface is required for such a bean to have bi-directional relationship with another entity bean

  4. Such a bean can have relationships with only message-driven beans

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

Container-managed relationships (CMR) in EJB 2.0 support one-to-one, one-to-many, and many-to-many relationships between entity beans. Get methods for relationships return java.util.Collection or java.util.Set, not Map. Remote interfaces are NOT required - local interfaces work fine. Entity beans can only have CMR relationships with other entity beans, not message-driven beans.

Multiple choice technology programming languages
  1. javax.ejb.AccessLocalException

  2. javax.rmi.NoSuchObjectException

  3. javax.ejb.NoSuchEntityException

  4. javax.rmi.StubNotFoundException

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

When a remote client invokes a method on an entity bean that has been removed, the container throws javax.rmi.NoSuchObjectException. This differs from local client views (which throw NoSuchObjectLocalException) and is specifically for RMI-based remote invocations. The exception indicates the referenced EJB object no longer exists.

Multiple choice technology programming languages
  1. The SELECT clause designates query domain

  2. An EJB QL query may have parameters.

  3. The WHERE clause determines the types of objects to be selected

  4. Of the three clause types, SELECT, FROM and WHERE, only the SELECT clause is required

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

EJB QL (EJB Query Language) supports parameters in queries using positional syntax (?1, ?2, etc.). The FROM clause designates the query domain (the entity abstract schema types), not SELECT. The WHERE clause filters results but doesn't determine types - that's FROM's job. Both FROM and SELECT are typically required (SELECT can be optional only for aggregate queries).

Multiple choice technology web technology
  1. DEBUG method

  2. OPTIONS method

  3. TRACE method

  4. HEAD method

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

The TRACE method echoes the received request back to the client so they can see what the intermediate servers received. It's used for debugging and diagnostic purposes - the final server sends back essentially the same request message it received. OPTIONS asks for available communication options, HEAD returns only headers, and DEBUG is not a standard HTTP method.

Multiple choice technology web technology
  1. /WEB-INF/classes

  2. /classes

  3. /META-INF/classes

  4. /root/classes

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

In a WAR file, compiled Java classes must be stored in /WEB-INF/classes directory following the standard WAR structure. This is part of the servlet specification. The /classes, /META-INF/classes, and /root/classes paths are not standard locations for compiled classes in a WAR file.

Multiple choice technology web technology
  1. setResponseContentType

  2. setContent

  3. setContentType

  4. setType

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

The HttpServletResponse interface has a setContentType(String) method that sets the content type of the response. This method is used to specify the MIME type (like text/html, application/json) and optionally the character encoding. The other options (setResponseContentType, setContent, setType) are not valid methods in HttpServletResponse.

Multiple choice technology web technology
  1. Programming language.

  2. Protocol.

  3. Framework.

  4. Web server.

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

JSF (JavaServer Faces) is a Java web application framework for building component-based user interfaces. It simplifies web development by providing reusable UI components, managing state, and handling server-side logic. It is NOT a programming language (A), protocol (B), or web server (D) - it's a framework that runs on web servers.