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 architecture
  1. In EJB 3.0, persistent fields must be identified through deployment descriptor.

  2. The persistent state of an entity is represented either by its persistent fields or persistent properties.

  3. For an EJB 3.0 entity, you no longer need to code interfaces such as LocalAddressHome and LocalAddress.

  4. In the Java Persistence API, you do not not need to provide an XML descriptor to specify an entity's primary key.

  5. Java Persistence API is simplified by removing support for complex relationships between Entities.

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

EJB 3.0 entities can use field or property-based persistence access, specified by annotations rather than XML descriptors. The complex home/local interface requirements (Home/LocalHome) are eliminated. JPA supports complex relationships (one-to-many, many-to-many) and still uses annotations or XML for primary key specification.

Multiple choice technology architecture
  1. Supports the processing of XML content, data binding, and the development SOAP based and RESTful Web Services.

  2. Web Services exposed by JAX-WS can only be of type document/literal.

  3. Stateless session beans cannot be exposed as web services using Java EE technology.

  4. JAX-WS greatly simplifies the web service implementation model.

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

JAX-WS supports multiple SOAP binding styles including RPC/literal and document/literal, not just document/literal. Stateless session beans CAN be exposed as JAX-WS web services using @WebService annotation. Java EE web services do support XML processing and JAX-WS simplifies implementation.

Multiple choice technology architecture
  1. When EJB is called by client, parameters will be passed by reference

  2. Methods must have RMI-IIOP compatible parameters and return types

  3. Methods must have JAXB compatible parameters and return types

  4. Use annotation @WebService and @WebMethod for deployment.

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

Remote interface calls use pass-by-value semantics due to RMI serialization requirements, not pass-by-reference. Remote EJB methods require RMI-IIOP compatible parameters. Web service methods require JAXB-compatible types for XML serialization. @WebService and @WebMethod annotations are used to expose beans as web services.

Multiple choice technology architecture
  1. Dependency Injection

  2. Interceptors

  3. Intercepting Filter Pattern

  4. None of the above. You need to write code for measuring response times.

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

EJB 3.0 Interceptors (@AroundInvoke) provide cross-cutting concerns like performance measurement without modifying business logic. An interceptor method can record start/end timestamps around the business method execution. Dependency injection is for resource injection, not timing.

Multiple choice technology architecture
  1. You must write ejbPassivate() method. Shift the logic to this method.

  2. Mention the method name in the deployment descriptor

  3. Use annotations

  4. There is no such facility in EJB3.0

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

EJB 3.0 uses lifecycle callback annotations like @PrePassivate to handle passivation events. The annotated method is automatically invoked when the container passivates the bean. This eliminates the need to implement callback interfaces or use deployment descriptors.

Multiple choice technology web technology
  1. Applets

  2. JSP

  3. JSP/Servlets

  4. JSP/Servlets and EJBs

  5. You would never replace PHP scripts with a J2EE technology

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

JSP and Servlets are the core J2EE technologies for server-side web applications. JSP (JavaServer Pages) handles the presentation layer with dynamic content generation, while Servlets manage the request/response processing and business logic. This combination directly parallels PHP's server-side scripting role, making it the natural replacement. Applets are client-side Java programs, while EJBs handle enterprise business logic and transaction management - unnecessary for simple PHP replacement.

Multiple choice technology web technology
  1. DNS

  2. JAF

  3. Java Naming

  4. JNDI

  5. JNS

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

JNDI (Java Naming and Directory Interface) is the standard Java API for accessing directory and naming services like LDAP. It provides a unified interface to connect to various directory services, making it the correct choice for LDAP integration. DNS is for domain name resolution, JAF (Java Activation Framework) handles MIME type processing, and 'Java Naming' or 'JNS' are not standard J2EE technologies.

Multiple choice technology web technology
  1. JAXP

  2. JAXR

  3. UDDI

  4. JSSE

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

JAXP (Java API for XML Processing) is designed for parsing, validating, and processing XML documents, making it the appropriate tool to read the response XML before updating the database. UDDI and JAXR are used for discovering and registering web services, while JSSE secures communications via SSL/TLS.

Multiple choice technology web technology
  1. JSF

  2. JCA

  3. Java EE Entities

  4. JMS

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

JSF (JavaServer Faces) is the modern Java EE framework that replaces custom MVC frameworks and JSP scriptlets with a component-based UI architecture. JPA Entities (Java Persistence API) replace complex entity beans with simpler POJO-based persistence, eliminating the need for facade session beans. JCA (Java Connector Architecture) connects legacy systems, and JMS handles messaging - neither addresses the stated migration needs.

Multiple choice technology web technology
  1. Availability

  2. Performance

  3. Manageability

  4. Maintainability

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

Increasing the number of web and application servers increases the complexity of administration, monitoring, and synchronization across the cluster, which negatively impacts manageability. Performance and availability are typically improved by scaling out, while maintainability is a codebase attribute less affected by runtime instances.

Multiple choice technology web technology
  1. Applets

  2. JSP

  3. JSP/Servlets

  4. JSP/Servlets and EJBs

  5. You would never replace PHP scripts with a J2EE technology

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

Replacing Perl and PHP scripts which contain both presentation and business logic requires a multi-layered J2EE architecture. JSP and Servlets handle the dynamic web presentation layer, while Enterprise JavaBeans (EJBs) manage the business logic and transaction processing, communicating with the database. Using JSPs/Servlets alone would lack a dedicated business logic tier.

Multiple choice technology web technology
  1. It is a fundamental

  2. It is a platform-independent, XML-based registry for businesses worldwide to be listed on the Internet.

  3. It is a bidirectional pull parser interface for streaming XML processing.

  4. It provides a convenient way to bind an XML schema to a representation in Java code.

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

UDDI (Universal Description, Discovery, and Integration) is an XML-based registry standard that enables businesses to publish and discover web services on the internet. It provides a structured directory where companies can list their services and others can find them. Option C describes StAX (Streaming API for XML), and Option D describes JAXB (Java Architecture for XML Binding).

Multiple choice technology web technology
  1. JAXB

  2. JAXR

  3. Enterprise Service Bus

  4. Simple Object Access Protocol

  5. REST

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

An Enterprise Service Bus (ESB) provides the fundamental infrastructure to integrate diverse systems (mainframe, client-server, standalone) under a unified, scalable, and secure Service-Oriented Architecture (SOA). JAXB and JAXR are Java-specific APIs for XML binding and registries, while SOAP and REST are communication protocols rather than integration platforms.

Multiple choice technology web technology
  1. Recode the application using JSF, EJB and Entities. This will improve the overall performance of the application and also improves maintainability

  2. Replace the auto-refresh functionality with AJAX code.

  3. Recode the application using JSF, EJB and Web Services.

  4. Use frames and put the auto-refresh part in a different frame.

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

Replacing the 60-second auto-refresh with AJAX allows asynchronous updates of just the stock prices without reloading the entire page, significantly improving user experience and reducing server load. This is a minimal, low-cost change that delivers immediate value. Complete rewrites with JSF/EJB (options A and C) are expensive overhauls, and frames (option D) are an outdated technique that doesn't solve the core usability issue.