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. Global Scope

  2. Application Scope

  3. Session Scope

  4. Request Scope

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

JSF/CDI uses standard scopes like @RequestScoped, @SessionScoped, @ApplicationScoped, @ViewScoped, @FlowScoped, and @ConversationScoped. 'Global Scope' is not a standard scope in JSF or CDI. Application Scope covers application-wide singletons, making Global Scope redundant and non-standard.

Multiple choice technology web technology
  1. FacesContext.getCurrentInstance().getViewRoot()

  2. FacesContext.getCurrentInstance().responseComplete()

  3. FacesContext.getCurrentInstance().renderResponse()

  4. FacesContext.getCurrentInstance().release()

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

To reload the page after a ValueChangeListener is invoked, call renderResponse() on FacesContext. This method instructs JSF to skip to the Render Response phase, effectively reloading the current view. responseComplete() ends processing without rendering, and getViewRoot() just retrieves the view root without triggering a reload.

Multiple choice technology programming languages
  1. Netscape invented JavaScript as a stripped-down "lite" version of Java

  2. Java borrowed ideas from JavaScript and made it a full-fledged programming language

  3. They both originate from the same research at Sun Microsystems

  4. There is none; it's all just marketing

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

Java and JavaScript are entirely distinct languages with different designs, use cases, and execution environments. The name similarity was purely a marketing decision by Netscape to capitalize on the popularity of Java at the time.

Multiple choice technology architecture
  1. Provide a standard for registries

  2. Provide a standard for repositories

  3. Declare an information model using XML schema to represent SOA Metadata

  4. Declare a collection of Web Services using Web Service Description Language (WSDL)

  5. None, UDDI facilities all of the above

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

UDDI DOES provide standards for registries (A), uses XML schema for SOA metadata representation (C), and declares web services using WSDL (D). What UDDI does NOT provide is a standard for repositories - it focuses on registries for service discovery, not full repository standards for storage and management.

Multiple choice technology architecture
  1. WSDL

  2. XML

  3. UDDI

  4. SOAP

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

SOAP (Simple Object Access Protocol) is the correct answer because it specifically defines an XML-based extensible message format, provides standard bindings to HTTP protocol, and establishes conventions for encoding data and representing remote procedure calls. WSDL describes services but doesn't define message formats or bindings, XML is only a markup language, and UDDI is for service discovery.

Multiple choice technology architecture
  1. Find

  2. Publish

  3. Bind

  4. Register

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

In the SOA publish-find-bind model, Publish describes making service descriptions available in a registry (like UDDI). Find is searching for services, Bind is connecting to use a service, and Register isn't one of the three core SOA operations. The question specifically asks about sending descriptions TO a registry.

Multiple choice technology architecture
  1. Accesses a WSDL description from the UDDI registry and binds to the service using SOAP

  2. Accesses a UDDI description from the WSDL registry and binds to the service using SOAP

  3. Accesses a SOAP description from the UDDI registry and binds to the service using UDDI

  4. Accesses a SOAP description from the WSDL registry and binds to the service using UDDI

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

The standard web service consumption pattern is: query UDDI registry for services, retrieve WSDL description of the desired service, then use SOAP to bind and invoke the service. WSDL describes the service interface, UDDI is the registry, and SOAP is the communication protocol.

Multiple choice technology web technology
  1. Asynchronous Web Services require message correlation

  2. Asynchronous Web Services tightly couple clients to the business processing

  3. Asynchronous Web Services are ideal for integrating with external business partners

  4. Asynchronous Web Services are best suited for simple fast business operations that return results

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

Asynchronous Web Services are ideal for external partner integration because they don't require real-time responsiveness and can handle variable response times and network latency. Option A is incorrect because while message correlation is often used, it's not an absolute requirement. Option B is incorrect because async services actually DECOUPLE clients from processing. Option D is incorrect because async services are suited for long-running operations, not simple fast operations.

Multiple choice technology architecture
  1. Declarative

  2. Structured

  3. Programmatic

  4. Both 1 and 3

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

Struts supports both declarative exception handling (configured in struts-config.xml using global-exceptions or exception mappings) and programmatic handling (try-catch blocks in Action classes). Declarative handling centralizes configuration while programmatic gives fine-grained control.

Multiple choice technology architecture
  1. Action Mapping

  2. Action Form

  3. HttpServletRequest

  4. HttpServletResponse

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

The execute() method in a Struts Action class receives four parameters: ActionMapping (describes the action mapping), ActionForm (contains form data), HttpServletRequest (the HTTP request object), and HttpServletResponse (the HTTP response object). These provide all necessary context for request processing.

Multiple choice technology web technology
  1. ListResultSet

  2. ResultSet

  3. ScrollableResultSet

  4. ScrollableResult

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

To understand what session.createQuery("Query").scroll() returns, the user needs to have understanding of Hibernate, Java and SQL.

Explanation of each option:

A. ListResultSet: This option is incorrect because ListResultSet is not a valid class in Hibernate.

B. ResultSet: This option is incorrect because ResultSet is a class in Java that represents a table of data representing a database result set, and it is not returned by the scroll() method in Hibernate.

C. ScrollableResultSet: This option is incorrect because ScrollableResultSet is not a valid class in Hibernate.

D. ScrollableResult: This option is correct. The scroll() method in Hibernate returns a ScrollableResult object, which is used to traverse a result set. It provides methods to move the cursor forward and backward, as well as methods to retrieve the current row or a subset of rows.

Therefore, the answer is: D. ScrollableResult.

Multiple choice technology web technology
  1. By placing hibernate.properties file in the classpath.

  2. Including <property> elements in hibernate.cfg.xml in the classpath.

  3. both 1 and 2

  4. none of the above

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

Hibernate can be configured in two common ways: by placing a hibernate.properties file in the classpath, or by using XML configuration with elements in hibernate.cfg.xml in the classpath. Both approaches allow setting database connection, dialect, and other configuration properties.

Multiple choice technology web technology
  1. configuration.buildSessionFactory();

  2. configuration.createSessionFactory();

  3. configuration.createNewSessionFactory();

  4. none of the above

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

To create a SessionFactory in Hibernate, you call the buildSessionFactory() method on a Configuration object. The typical pattern is: SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();